summaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-05-25 08:12:59 +0200
committerJens Axboe <axboe@kernel.dk>2021-06-01 07:45:27 -0600
commitab4b57057d744861f670b47b163209727b26418b (patch)
tree2d978987284bb49a1b3b466fabdb62f680694210 /fs/block_dev.c
parentc8276b954d2dacbabe587c0421a9344529af5bad (diff)
downloadlinux-ab4b57057d744861f670b47b163209727b26418b.tar.gz
linux-ab4b57057d744861f670b47b163209727b26418b.tar.bz2
linux-ab4b57057d744861f670b47b163209727b26418b.zip
block: move bd_part_count to struct gendisk
The bd_part_count value only makes sense for whole devices, so move it to struct gendisk and give it a more descriptive name. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20210525061301.2242282-7-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index cd45b54e86b4..ac9b3c158a77 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1253,7 +1253,7 @@ int bdev_disk_changed(struct block_device *bdev, bool invalidate)
return -ENXIO;
rescan:
- if (bdev->bd_part_count)
+ if (disk->open_partitions)
return -EBUSY;
sync_blockdev(bdev);
invalidate_bdev(bdev);
@@ -1348,7 +1348,7 @@ static int blkdev_get_part(struct block_device *part, fmode_t mode)
if (!bdev_nr_sectors(part))
goto out_blkdev_put;
- whole->bd_part_count++;
+ disk->open_partitions++;
set_init_blocksize(part);
if (part->bd_bdi == &noop_backing_dev_info)
part->bd_bdi = bdi_get(disk->queue->backing_dev_info);
@@ -1370,7 +1370,7 @@ static void blkdev_put_part(struct block_device *part, fmode_t mode)
if (--part->bd_openers)
return;
blkdev_flush_mapping(part);
- whole->bd_part_count--;
+ whole->bd_disk->open_partitions--;
blkdev_put_whole(whole, mode);
bdput(whole);
}