aboutsummaryrefslogtreecommitdiff
path: root/drivers/md/raid6main.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2005-11-28 13:44:13 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-28 14:42:26 -0800
commit6aea114a728db9296f42102d4885e7fb035de0a9 (patch)
treefa03f942fea0fef446a10cba423f2eee890c5d89 /drivers/md/raid6main.c
parentb2a2703c282ce77d189a250f58039daac1da3314 (diff)
[PATCH] md: fix --re-add for raid1 and raid6
If you have an array with a write-intent-bitmap, and you remove a device, then re-add it, a full recovery isn't needed. We detect a re-add by looking at saved_raid_disk. For raid1, it doesn't matter which disk it was, only whether or not it was an active device. The old code being removed set a value of 'mirror' which was then ignored, so it can go. The changed code performs the correct check. For raid6, if there are two missing devices, make sure we chose the right slot on --re-add rather than always the first slot. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/raid6main.c')
-rw-r--r--drivers/md/raid6main.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c
index 00da37848d0..0000d162d19 100644
--- a/drivers/md/raid6main.c
+++ b/drivers/md/raid6main.c
@@ -2158,9 +2158,15 @@ static int raid6_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
/* no point adding a device */
return 0;
/*
- * find the disk ...
+ * find the disk ... but prefer rdev->saved_raid_disk
+ * if possible.
*/
- for (disk=0; disk < mddev->raid_disks; disk++)
+ if (rdev->saved_raid_disk >= 0 &&
+ conf->disks[rdev->saved_raid_disk].rdev == NULL)
+ disk = rdev->saved_raid_disk;
+ else
+ disk = 0;
+ for ( ; disk < mddev->raid_disks; disk++)
if ((p=conf->disks + disk)->rdev == NULL) {
clear_bit(In_sync, &rdev->flags);
rdev->raid_disk = disk;