mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 22:02:02 +00:00
block: move more syncing and invalidation to delete_partition
Move the calls to fsync_bdev and __invalidate_device from del_gendisk to delete_partition. For the other two callers that check that there are no openers for the delete partitions(s) the callouts are a no-op as no file system can be mounted, but this keeps all the cleanup in one place. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20210406062303.811835-4-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
45611837bb
commit
473338be3a
2 changed files with 4 additions and 7 deletions
|
@ -686,11 +686,8 @@ void del_gendisk(struct gendisk *disk)
|
||||||
|
|
||||||
/* invalidate stuff */
|
/* invalidate stuff */
|
||||||
disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
|
disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
|
||||||
while ((part = disk_part_iter_next(&piter))) {
|
while ((part = disk_part_iter_next(&piter)))
|
||||||
fsync_bdev(part);
|
|
||||||
__invalidate_device(part, true);
|
|
||||||
delete_partition(part);
|
delete_partition(part);
|
||||||
}
|
|
||||||
disk_part_iter_exit(&piter);
|
disk_part_iter_exit(&piter);
|
||||||
|
|
||||||
fsync_bdev(disk->part0);
|
fsync_bdev(disk->part0);
|
||||||
|
|
|
@ -287,6 +287,9 @@ struct device_type part_type = {
|
||||||
*/
|
*/
|
||||||
void delete_partition(struct block_device *part)
|
void delete_partition(struct block_device *part)
|
||||||
{
|
{
|
||||||
|
fsync_bdev(part);
|
||||||
|
__invalidate_device(part, true);
|
||||||
|
|
||||||
xa_erase(&part->bd_disk->part_tbl, part->bd_partno);
|
xa_erase(&part->bd_disk->part_tbl, part->bd_partno);
|
||||||
kobject_put(part->bd_holder_dir);
|
kobject_put(part->bd_holder_dir);
|
||||||
device_del(&part->bd_device);
|
device_del(&part->bd_device);
|
||||||
|
@ -468,9 +471,6 @@ int bdev_del_partition(struct block_device *bdev, int partno)
|
||||||
if (part->bd_openers)
|
if (part->bd_openers)
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
||||||
sync_blockdev(part);
|
|
||||||
invalidate_bdev(part);
|
|
||||||
|
|
||||||
delete_partition(part);
|
delete_partition(part);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
out_unlock:
|
out_unlock:
|
||||||
|
|
Loading…
Reference in a new issue