diff options
author | NeilBrown <neilb@cse.unsw.edu.au> | 2005-06-21 20:17:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-21 22:07:46 -0400 |
commit | 41158c7eb22312cfaa256744e1553bb4042ff085 (patch) | |
tree | 21c28e0630d66fc32d758993299a78088a846562 /drivers/md/raid1.c | |
parent | 289e99e8ed8f36e386bf7de49947311c17ae1482 (diff) |
[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.c | 7 |
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) | |||
811 | { | 811 | { |
812 | conf_t *conf = mddev->private; | 812 | conf_t *conf = mddev->private; |
813 | int found = 0; | 813 | int found = 0; |
814 | int mirror; | 814 | int mirror = 0; |
815 | mirror_info_t *p; | 815 | mirror_info_t *p; |
816 | 816 | ||
817 | if (rdev->saved_raid_disk >= 0 && | ||
818 | conf->mirrors[rdev->saved_raid_disk].rdev == NULL) | ||
819 | mirror = rdev->saved_raid_disk; | ||
817 | for (mirror=0; mirror < mddev->raid_disks; mirror++) | 820 | for (mirror=0; mirror < mddev->raid_disks; mirror++) |
818 | if ( !(p=conf->mirrors+mirror)->rdev) { | 821 | if ( !(p=conf->mirrors+mirror)->rdev) { |
819 | 822 | ||
@@ -830,6 +833,8 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
830 | p->head_position = 0; | 833 | p->head_position = 0; |
831 | rdev->raid_disk = mirror; | 834 | rdev->raid_disk = mirror; |
832 | found = 1; | 835 | found = 1; |
836 | if (rdev->saved_raid_disk != mirror) | ||
837 | conf->fullsync = 1; | ||
833 | p->rdev = rdev; | 838 | p->rdev = rdev; |
834 | break; | 839 | break; |
835 | } | 840 | } |