From: NeilBrown Date: Tue, 14 Jan 2014 04:55:14 +0000 (+1100) Subject: md: allow a partially recovered device to be hot-added to an array. X-Git-Tag: v3.14-rc1~101^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7eb418851f3278de67126ea0c427641ab4792c57;p=profile%2Fivi%2Fkernel-x86-ivi.git md: allow a partially recovered device to be hot-added to an array. When adding a new device into an array it is normally important to clear any stale data from ->recovery_offset else the new device may not be recovered properly. However when re-adding a device which is known to be nearly in-sync, this is not needed and can be detrimental. The (bitmap-based) resync will still happen, and further recovery is only needed from where-ever it was already up to. So if save_raid_disk is set, signifying a re-add, don't clear ->recovery_offset. Signed-off-by: NeilBrown --- diff --git a/drivers/md/md.c b/drivers/md/md.c index 539f088..757e388 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -7736,7 +7736,8 @@ static int remove_and_add_spares(struct mddev *mddev, !test_bit(Bitmap_sync, &rdev->flags))) continue; - rdev->recovery_offset = 0; + if (rdev->saved_raid_disk < 0) + rdev->recovery_offset = 0; if (mddev->pers-> hot_add_disk(mddev, rdev) == 0) { if (sysfs_link_rdev(mddev, rdev))