diff options
author | Christoph Hellwig <hch@lst.de> | 2020-11-24 11:20:37 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-12-02 00:53:40 +0300 |
commit | 71773cf797490e1cbe4909b25a2543937e7eea82 (patch) | |
tree | 6879e455d2ca905f02af79dd7b4e6e3a45cb2107 /block/genhd.c | |
parent | 9fc995a6e08349b5c5baff2cc31544b96ee2b1c3 (diff) | |
download | linux-71773cf797490e1cbe4909b25a2543937e7eea82.tar.xz |
block: pass a block_device to invalidate_partition
Pass the block_device actually needed instead of looking it up using
bdget_disk.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/genhd.c')
-rw-r--r-- | block/genhd.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/block/genhd.c b/block/genhd.c index fd6333332ab5..452f7c646e02 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -803,14 +803,8 @@ void device_add_disk_no_queue_reg(struct device *parent, struct gendisk *disk) } EXPORT_SYMBOL(device_add_disk_no_queue_reg); -static void invalidate_partition(struct gendisk *disk, int partno) +static void invalidate_partition(struct block_device *bdev) { - struct block_device *bdev; - - bdev = bdget_disk(disk, partno); - if (!bdev) - return; - fsync_bdev(bdev); __invalidate_device(bdev, true); @@ -819,7 +813,6 @@ static void invalidate_partition(struct gendisk *disk, int partno) * up any more even if openers still hold references to it. */ remove_inode_hash(bdev->bd_inode); - bdput(bdev); } /** @@ -864,12 +857,12 @@ void del_gendisk(struct gendisk *disk) disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY | DISK_PITER_REVERSE); while ((part = disk_part_iter_next(&piter))) { - invalidate_partition(disk, part->bdev->bd_partno); + invalidate_partition(part->bdev); delete_partition(part); } disk_part_iter_exit(&piter); - invalidate_partition(disk, 0); + invalidate_partition(disk->part0); set_capacity(disk, 0); disk->flags &= ~GENHD_FL_UP; up_write(&bdev_lookup_sem); |