[PATCH 03/11] block: move more syncing and invalidation to delete_partition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 block/genhd.c           | 5 +----
 block/partitions/core.c | 6 +++---
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 9b121b1f79982f..15f99da4543f6d 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -686,11 +686,8 @@ void del_gendisk(struct gendisk *disk)
 
 	/* invalidate stuff */
 	disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
-	while ((part = disk_part_iter_next(&piter))) {
-		fsync_bdev(part);
-		__invalidate_device(part, true);
+	while ((part = disk_part_iter_next(&piter)))
 		delete_partition(part);
-	}
 	disk_part_iter_exit(&piter);
 
 	fsync_bdev(disk->part0);
diff --git a/block/partitions/core.c b/block/partitions/core.c
index 22a0dab17ed343..8c173529294081 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -287,6 +287,9 @@ struct device_type part_type = {
  */
 void delete_partition(struct block_device *part)
 {
+	fsync_bdev(part);
+	__invalidate_device(part, true);
+
 	xa_erase(&part->bd_disk->part_tbl, part->bd_partno);
 	kobject_put(part->bd_holder_dir);
 	device_del(&part->bd_device);
@@ -468,9 +471,6 @@ int bdev_del_partition(struct block_device *bdev, int partno)
 	if (part->bd_openers)
 		goto out_unlock;
 
-	sync_blockdev(part);
-	invalidate_bdev(part);
-
 	delete_partition(part);
 	ret = 0;
 out_unlock:
-- 
2.30.1




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux