Message ID | 20230518042323.663189-9-hch@lst.de (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [01/13] block: factor out a bd_end_claim helper from blkdev_put | expand |
On Thu 18-05-23 06:23:17, Christoph Hellwig wrote: > There is only a single caller left, so fold the loop into that. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Sure. Feel free to add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > --- > block/partitions/core.c | 16 ++++------------ > 1 file changed, 4 insertions(+), 12 deletions(-) > > diff --git a/block/partitions/core.c b/block/partitions/core.c > index 31ac815d77a83c..2559bb830273eb 100644 > --- a/block/partitions/core.c > +++ b/block/partitions/core.c > @@ -524,17 +524,6 @@ static bool disk_unlock_native_capacity(struct gendisk *disk) > return true; > } > > -static void blk_drop_partitions(struct gendisk *disk) > -{ > - struct block_device *part; > - unsigned long idx; > - > - lockdep_assert_held(&disk->open_mutex); > - > - xa_for_each_start(&disk->part_tbl, idx, part, 1) > - delete_partition(part); > -} > - > static bool blk_add_partition(struct gendisk *disk, > struct parsed_partitions *state, int p) > { > @@ -651,6 +640,8 @@ static int blk_add_partitions(struct gendisk *disk) > > int bdev_disk_changed(struct gendisk *disk, bool invalidate) > { > + struct block_device *part; > + unsigned long idx; > int ret = 0; > > lockdep_assert_held(&disk->open_mutex); > @@ -663,8 +654,9 @@ int bdev_disk_changed(struct gendisk *disk, bool invalidate) > return -EBUSY; > sync_blockdev(disk->part0); > invalidate_bdev(disk->part0); > - blk_drop_partitions(disk); > > + xa_for_each_start(&disk->part_tbl, idx, part, 1) > + delete_partition(part); > clear_bit(GD_NEED_PART_SCAN, &disk->state); > > /* > -- > 2.39.2 >
diff --git a/block/partitions/core.c b/block/partitions/core.c index 31ac815d77a83c..2559bb830273eb 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -524,17 +524,6 @@ static bool disk_unlock_native_capacity(struct gendisk *disk) return true; } -static void blk_drop_partitions(struct gendisk *disk) -{ - struct block_device *part; - unsigned long idx; - - lockdep_assert_held(&disk->open_mutex); - - xa_for_each_start(&disk->part_tbl, idx, part, 1) - delete_partition(part); -} - static bool blk_add_partition(struct gendisk *disk, struct parsed_partitions *state, int p) { @@ -651,6 +640,8 @@ static int blk_add_partitions(struct gendisk *disk) int bdev_disk_changed(struct gendisk *disk, bool invalidate) { + struct block_device *part; + unsigned long idx; int ret = 0; lockdep_assert_held(&disk->open_mutex); @@ -663,8 +654,9 @@ int bdev_disk_changed(struct gendisk *disk, bool invalidate) return -EBUSY; sync_blockdev(disk->part0); invalidate_bdev(disk->part0); - blk_drop_partitions(disk); + xa_for_each_start(&disk->part_tbl, idx, part, 1) + delete_partition(part); clear_bit(GD_NEED_PART_SCAN, &disk->state); /*
There is only a single caller left, so fold the loop into that. Signed-off-by: Christoph Hellwig <hch@lst.de> --- block/partitions/core.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)