aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-04-06 08:22:53 +0200
committerJens Axboe <axboe@kernel.dk>2021-04-08 10:24:36 -0600
commit45611837bb37e4544ca048e33d833483b06e3b03 (patch)
treeeeb9c5d97e842aec1d7c9097cbe75b18f5a1db40 /block
parentb896fa85e0ee4f09ba4be48a3f405fc82c38afb4 (diff)
block: remove invalidate_partition
invalidate_partition has two callers, one of which already performs the remove_inode_hash just after the call. Just open code the function in the two callsites. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20210406062303.811835-3-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/genhd.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 8c8f543572e6..9b121b1f7998 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -646,18 +646,6 @@ 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 block_device *bdev)
-{
- fsync_bdev(bdev);
- __invalidate_device(bdev, true);
-
- /*
- * Unhash the bdev inode for this device so that it can't be looked
- * up any more even if openers still hold references to it.
- */
- remove_inode_hash(bdev->bd_inode);
-}
-
/**
* del_gendisk - remove the gendisk
* @disk: the struct gendisk to remove
@@ -699,12 +687,21 @@ void del_gendisk(struct gendisk *disk)
/* invalidate stuff */
disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
while ((part = disk_part_iter_next(&piter))) {
- invalidate_partition(part);
+ fsync_bdev(part);
+ __invalidate_device(part, true);
delete_partition(part);
}
disk_part_iter_exit(&piter);
- invalidate_partition(disk->part0);
+ fsync_bdev(disk->part0);
+ __invalidate_device(disk->part0, true);
+
+ /*
+ * Unhash the bdev inode for this device so that it can't be looked
+ * up any more even if openers still hold references to it.
+ */
+ remove_inode_hash(disk->part0->bd_inode);
+
set_capacity(disk, 0);
disk->flags &= ~GENHD_FL_UP;
up_write(&bdev_lookup_sem);

Privacy Policy