[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 41/45] 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@xxxxxx>
---
 block/genhd.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 498c816e90df64..2985740eab084b 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -790,14 +790,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);
 
@@ -806,7 +800,6 @@ static void invalidate_partition(struct gendisk *disk, int 
partno)
         * as last inode reference is dropped.
         */
        remove_inode_hash(bdev->bd_inode);
-       bdput(bdev);
 }
 
 /**
@@ -847,12 +840,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);
 
        if (!(disk->flags & GENHD_FL_HIDDEN)) {
-- 
2.29.2




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.