forked from Minki/linux
block: rename bd_invalidated
Replace bd_invalidate with a new BDEV_NEED_PART_SCAN flag in a bd_flags variable to better describe the condition. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
6540fbf6b6
commit
f4ad06f2bb
@ -732,7 +732,7 @@ static void register_disk(struct device *parent, struct gendisk *disk,
|
||||
if (!bdev)
|
||||
goto exit;
|
||||
|
||||
bdev->bd_invalidated = 1;
|
||||
set_bit(BDEV_NEED_PART_SCAN, &bdev->bd_flags);
|
||||
err = blkdev_get(bdev, FMODE_READ, NULL);
|
||||
if (err < 0)
|
||||
goto exit;
|
||||
|
@ -315,7 +315,7 @@ static void nbd_size_update(struct nbd_device *nbd)
|
||||
bd_set_nr_sectors(bdev, nr_sectors);
|
||||
set_blocksize(bdev, config->blksize);
|
||||
} else
|
||||
bdev->bd_invalidated = 1;
|
||||
set_bit(BDEV_NEED_PART_SCAN, &bdev->bd_flags);
|
||||
bdput(bdev);
|
||||
}
|
||||
kobject_uevent(&nbd_to_dev(nbd)->kobj, KOBJ_CHANGE);
|
||||
@ -1322,7 +1322,7 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *b
|
||||
return ret;
|
||||
|
||||
if (max_part)
|
||||
bdev->bd_invalidated = 1;
|
||||
set_bit(BDEV_NEED_PART_SCAN, &bdev->bd_flags);
|
||||
mutex_unlock(&nbd->config_lock);
|
||||
ret = wait_event_interruptible(config->recv_wq,
|
||||
atomic_read(&config->recv_threads) == 0);
|
||||
@ -1500,9 +1500,9 @@ static int nbd_open(struct block_device *bdev, fmode_t mode)
|
||||
refcount_set(&nbd->config_refs, 1);
|
||||
refcount_inc(&nbd->refs);
|
||||
mutex_unlock(&nbd->config_lock);
|
||||
bdev->bd_invalidated = 1;
|
||||
set_bit(BDEV_NEED_PART_SCAN, &bdev->bd_flags);
|
||||
} else if (nbd_disconnected(nbd->config)) {
|
||||
bdev->bd_invalidated = 1;
|
||||
set_bit(BDEV_NEED_PART_SCAN, &bdev->bd_flags);
|
||||
}
|
||||
out:
|
||||
mutex_unlock(&nbd_index_mutex);
|
||||
|
@ -881,7 +881,7 @@ struct block_device *bdget(dev_t dev)
|
||||
bdev->bd_super = NULL;
|
||||
bdev->bd_inode = inode;
|
||||
bdev->bd_part_count = 0;
|
||||
bdev->bd_invalidated = 0;
|
||||
bdev->bd_flags = 0;
|
||||
inode->i_mode = S_IFBLK;
|
||||
inode->i_rdev = dev;
|
||||
inode->i_bdev = bdev;
|
||||
@ -1365,7 +1365,7 @@ int check_disk_change(struct block_device *bdev)
|
||||
if (__invalidate_device(bdev, true))
|
||||
pr_warn("VFS: busy inodes on changed media %s\n",
|
||||
disk->disk_name);
|
||||
bdev->bd_invalidated = 1;
|
||||
set_bit(BDEV_NEED_PART_SCAN, &bdev->bd_flags);
|
||||
if (bdops->revalidate_disk)
|
||||
bdops->revalidate_disk(bdev->bd_disk);
|
||||
return 1;
|
||||
@ -1390,7 +1390,7 @@ int bdev_disk_changed(struct block_device *bdev, bool invalidate)
|
||||
|
||||
lockdep_assert_held(&bdev->bd_mutex);
|
||||
|
||||
bdev->bd_invalidated = 0;
|
||||
clear_bit(BDEV_NEED_PART_SCAN, &bdev->bd_flags);
|
||||
|
||||
rescan:
|
||||
ret = blk_drop_partitions(bdev);
|
||||
@ -1514,7 +1514,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, void *holder,
|
||||
* The latter is necessary to prevent ghost
|
||||
* partitions on a removed medium.
|
||||
*/
|
||||
if (bdev->bd_invalidated &&
|
||||
if (test_bit(BDEV_NEED_PART_SCAN, &bdev->bd_flags) &&
|
||||
(!ret || ret == -ENOMEDIUM))
|
||||
bdev_disk_changed(bdev, ret == -ENOMEDIUM);
|
||||
|
||||
@ -1544,7 +1544,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, void *holder,
|
||||
if (bdev->bd_disk->fops->open)
|
||||
ret = bdev->bd_disk->fops->open(bdev, mode);
|
||||
/* the same as first opener case, read comment there */
|
||||
if (bdev->bd_invalidated &&
|
||||
if (test_bit(BDEV_NEED_PART_SCAN, &bdev->bd_flags) &&
|
||||
(!ret || ret == -ENOMEDIUM))
|
||||
bdev_disk_changed(bdev, ret == -ENOMEDIUM);
|
||||
if (ret)
|
||||
|
@ -19,6 +19,8 @@ struct cgroup_subsys_state;
|
||||
typedef void (bio_end_io_t) (struct bio *);
|
||||
struct bio_crypt_ctx;
|
||||
|
||||
#define BDEV_NEED_PART_SCAN 0
|
||||
|
||||
struct block_device {
|
||||
dev_t bd_dev;
|
||||
int bd_openers;
|
||||
@ -37,7 +39,7 @@ struct block_device {
|
||||
struct hd_struct * bd_part;
|
||||
/* number of times partitions within this device have been opened. */
|
||||
unsigned bd_part_count;
|
||||
int bd_invalidated;
|
||||
unsigned long bd_flags;
|
||||
spinlock_t bd_size_lock; /* for bd_inode->i_size updates */
|
||||
struct gendisk * bd_disk;
|
||||
struct backing_dev_info *bd_bdi;
|
||||
|
Loading…
Reference in New Issue
Block a user