diff options
author | Martin Wilck <mwilck@arcor.de> | 2013-04-24 11:42:42 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2013-04-24 11:42:42 +1000 |
commit | 7e83ccbecd608b971f340e951c9e84cd0343002f (patch) | |
tree | eccd87d8d0f04cbc3aa95c18c50b05aafc1d032c /drivers/md | |
parent | b6fec069af5a26439f7d36cb3d4f5dd1378af7e2 (diff) |
md/raid10: Allow skipping recovery when clean arrays are assembled
When an array is assembled incrementally with mdadm -I -R
and the array switches to "active" mode, md starts a recovery.
If the array was clean, the "fullsync" flag will be 0. Skip
the full recovery in this case, as RAID1 does (the code was
actually copied from the sync_request() method of RAID1).
Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/raid10.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 77b562d18a90..2372926dc559 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -2913,6 +2913,22 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, if (init_resync(conf)) return 0; + /* + * Allow skipping a full rebuild for incremental assembly + * of a clean array, like RAID1 does. + */ + if (mddev->bitmap == NULL && + mddev->recovery_cp == MaxSector && + !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery) && + conf->fullsync == 0) { + *skipped = 1; + max_sector = mddev->dev_sectors; + if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery) || + test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) + max_sector = mddev->resync_max_sectors; + return max_sector - sector_nr; + } + skipped: max_sector = mddev->dev_sectors; if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery) || |