Skip to content

Commit e669c1d

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: don't call invalidate_partition from blk_drop_partitions
Given that the device must not be busy, most of the calls from invalidate_partition that are related to file system metadata are guranteed to not happen. Just open code the calls to sync_blockdev and invalidate_bdev instead. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 21be6cd commit e669c1d

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎block/partitions/core.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,15 +607,14 @@ int blk_drop_partitions(struct block_device *bdev)
607607
{
608608
struct disk_part_iter piter;
609609
struct hd_struct *part;
610-
int res;
611610

612611
if (!disk_part_scan_enabled(bdev->bd_disk))
613612
return 0;
614613
if (bdev->bd_part_count || bdev->bd_openers > 1)
615614
return -EBUSY;
616-
res = invalidate_partition(bdev->bd_disk, 0);
617-
if (res)
618-
return res;
615+
616+
sync_blockdev(bdev);
617+
invalidate_bdev(bdev);
619618

620619
disk_part_iter_init(&piter, bdev->bd_disk, DISK_PITER_INCL_EMPTY);
621620
while ((part = disk_part_iter_next(&piter)))

0 commit comments

Comments
 (0)