summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-09-21 09:19:45 +0200
committerJens Axboe <axboe@kernel.dk>2020-09-23 10:43:18 -0600
commit38430f0876fa8b9549ec434f569dce03e057c076 (patch)
treeb8137369a29bfc6158d781ad1e4897cbd6a2062f /fs
parent07d098e6bbad04030dab5b3e64149601fcb063ce (diff)
block: move the NEED_PART_SCAN flag to struct gendisk
We can only scan for partitions on the whole disk, so move the flag from struct block_device to struct gendisk. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r--fs/block_dev.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 0b34955b9e36..1a9325f43157 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -910,7 +910,6 @@ struct block_device *bdget(dev_t dev)
bdev->bd_super = NULL;
bdev->bd_inode = inode;
bdev->bd_part_count = 0;
- bdev->bd_flags = 0;
inode->i_mode = S_IFBLK;
inode->i_rdev = dev;
inode->i_bdev = bdev;
@@ -1385,7 +1384,7 @@ int bdev_disk_changed(struct block_device *bdev, bool invalidate)
lockdep_assert_held(&bdev->bd_mutex);
- clear_bit(BDEV_NEED_PART_SCAN, &bdev->bd_flags);
+ clear_bit(GD_NEED_PART_SCAN, &bdev->bd_disk->state);
rescan:
ret = blk_drop_partitions(bdev);
@@ -1509,7 +1508,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 (test_bit(BDEV_NEED_PART_SCAN, &bdev->bd_flags) &&
+ if (test_bit(GD_NEED_PART_SCAN, &disk->state) &&
(!ret || ret == -ENOMEDIUM))
bdev_disk_changed(bdev, ret == -ENOMEDIUM);
@@ -1539,7 +1538,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 (test_bit(BDEV_NEED_PART_SCAN, &bdev->bd_flags) &&
+ if (test_bit(GD_NEED_PART_SCAN, &disk->state) &&
(!ret || ret == -ENOMEDIUM))
bdev_disk_changed(bdev, ret == -ENOMEDIUM);
if (ret)