summaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@cse.unsw.edu.au>2005-06-22 02:17:25 +0200
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-22 04:07:46 +0200
commit41158c7eb22312cfaa256744e1553bb4042ff085 (patch)
tree21c28e0630d66fc32d758993299a78088a846562 /drivers/md/raid1.c
parent[PATCH] md: initialise sync_blocks in raid1 resync (diff)
downloadlinux-41158c7eb22312cfaa256744e1553bb4042ff085.tar.xz
linux-41158c7eb22312cfaa256744e1553bb4042ff085.zip
[PATCH] md: optimise reconstruction when re-adding a recently failed drive.
When an array is degraded, bit in the intent-bitmap are never cleared. So if a recently failed drive is re-added, we only need to reconstruct the block that are still reflected in the bitmap. This patch adds support for this re-adding. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index c3b4772cfaea..3f5234fe3593 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -811,9 +811,12 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
{
conf_t *conf = mddev->private;
int found = 0;
- int mirror;
+ int mirror = 0;
mirror_info_t *p;
+ if (rdev->saved_raid_disk >= 0 &&
+ conf->mirrors[rdev->saved_raid_disk].rdev == NULL)
+ mirror = rdev->saved_raid_disk;
for (mirror=0; mirror < mddev->raid_disks; mirror++)
if ( !(p=conf->mirrors+mirror)->rdev) {
@@ -830,6 +833,8 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
p->head_position = 0;
rdev->raid_disk = mirror;
found = 1;
+ if (rdev->saved_raid_disk != mirror)
+ conf->fullsync = 1;
p->rdev = rdev;
break;
}