From: Li Nan Date: Mon, 5 Jan 2026 11:02:57 +0000 (+0800) Subject: md: move finish_reshape to md_finish_sync() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ff59a72478d6e9f9668e153dbdbdfad7928b123;p=thirdparty%2Fkernel%2Flinux.git md: move finish_reshape to md_finish_sync() finish_reshape implementations of raid10 and raid5 only update mddev and rdev configurations. Move these operations to md_finish_sync() as it is more appropriate. No functional changes. Link: https://lore.kernel.org/linux-raid/20260105110300.1442509-10-linan666@huaweicloud.com Signed-off-by: Li Nan Reviewed-by: Yu Kuai Signed-off-by: Yu Kuai --- diff --git a/drivers/md/md.c b/drivers/md/md.c index 7b4fe7379bb6c..d7f94b50694d4 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -9475,6 +9475,8 @@ static void md_finish_sync(struct mddev *mddev, enum sync_action action) set_capacity_and_notify(mddev->gendisk, mddev->array_sectors); } + if (mddev->pers->finish_reshape) + mddev->pers->finish_reshape(mddev); break; /* */ case ACTION_CHECK: @@ -10312,7 +10314,7 @@ void md_reap_sync_thread(struct mddev *mddev) { struct md_rdev *rdev; sector_t old_dev_sectors = mddev->dev_sectors; - bool is_reshaped = false; + bool is_reshaped = test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery); /* resync has finished, collect result */ md_unregister_thread(mddev, &mddev->sync_thread); @@ -10328,12 +10330,6 @@ void md_reap_sync_thread(struct mddev *mddev) set_bit(MD_SB_CHANGE_DEVS, &mddev->sb_flags); } } - if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) && - mddev->pers->finish_reshape) { - mddev->pers->finish_reshape(mddev); - if (mddev_is_clustered(mddev)) - is_reshaped = true; - } /* If array is no-longer degraded, then any saved_raid_disk * information must be scrapped. @@ -10360,8 +10356,9 @@ void md_reap_sync_thread(struct mddev *mddev) * be changed by md_update_sb, and MD_RECOVERY_RESHAPE is cleared, * so it is time to update size across cluster. */ - if (mddev_is_clustered(mddev) && is_reshaped - && !test_bit(MD_CLOSING, &mddev->flags)) + if (mddev_is_clustered(mddev) && is_reshaped && + mddev->pers->finish_reshape && + !test_bit(MD_CLOSING, &mddev->flags)) mddev->cluster_ops->update_size(mddev, old_dev_sectors); /* flag recovery needed just to double check */ set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);