aboutsummaryrefslogtreecommitdiffstats
path: root/block/genhd.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-04-06 08:22:55 +0200
committerJens Axboe <axboe@kernel.dk>2021-04-08 10:24:36 -0600
commitd3c4a43d9291279c28b26757351a6ab72c110753 (patch)
tree191523e681fdff315c7e14029ace1a42ce1aaa5e /block/genhd.c
parentblock: move more syncing and invalidation to delete_partition (diff)
downloadlinux-dev-d3c4a43d9291279c28b26757351a6ab72c110753.tar.xz
linux-dev-d3c4a43d9291279c28b26757351a6ab72c110753.zip
block: refactor blk_drop_partitions
Move the busy check and disk-wide sync into the only caller, so that the remainder can be shared with del_gendisk. Also pass the gendisk instead of the bdev as that is all that is needed. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20210406062303.811835-5-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 15f99da4543f..8303ec67fd70 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -667,9 +667,6 @@ EXPORT_SYMBOL(device_add_disk_no_queue_reg);
*/
void del_gendisk(struct gendisk *disk)
{
- struct disk_part_iter piter;
- struct block_device *part;
-
might_sleep();
if (WARN_ON_ONCE(!disk->queue))
@@ -683,13 +680,7 @@ void del_gendisk(struct gendisk *disk)
* disk is marked as dead (GENHD_FL_UP cleared).
*/
down_write(&bdev_lookup_sem);
-
- /* invalidate stuff */
- disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
- while ((part = disk_part_iter_next(&piter)))
- delete_partition(part);
- disk_part_iter_exit(&piter);
-
+ blk_drop_partitions(disk);
fsync_bdev(disk->part0);
__invalidate_device(disk->part0, true);