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>
This commit is contained in:
committed by
Jens Axboe
parent
21be6cdc00
commit
e669c1da03
@@ -607,15 +607,14 @@ int blk_drop_partitions(struct block_device *bdev)
|
|||||||
{
|
{
|
||||||
struct disk_part_iter piter;
|
struct disk_part_iter piter;
|
||||||
struct hd_struct *part;
|
struct hd_struct *part;
|
||||||
int res;
|
|
||||||
|
|
||||||
if (!disk_part_scan_enabled(bdev->bd_disk))
|
if (!disk_part_scan_enabled(bdev->bd_disk))
|
||||||
return 0;
|
return 0;
|
||||||
if (bdev->bd_part_count || bdev->bd_openers > 1)
|
if (bdev->bd_part_count || bdev->bd_openers > 1)
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
res = invalidate_partition(bdev->bd_disk, 0);
|
|
||||||
if (res)
|
sync_blockdev(bdev);
|
||||||
return res;
|
invalidate_bdev(bdev);
|
||||||
|
|
||||||
disk_part_iter_init(&piter, bdev->bd_disk, DISK_PITER_INCL_EMPTY);
|
disk_part_iter_init(&piter, bdev->bd_disk, DISK_PITER_INCL_EMPTY);
|
||||||
while ((part = disk_part_iter_next(&piter)))
|
while ((part = disk_part_iter_next(&piter)))
|
||||||
|
|||||||
Reference in New Issue
Block a user