diff options
author | Neil Brown <neilb@notabene.brown> | 2008-06-27 18:31:31 -0400 |
---|---|---|
committer | Neil Brown <neilb@notabene.brown> | 2008-06-27 18:31:31 -0400 |
commit | 6c2fce2ef6b4821c21b5c42c7207cb9cf8c87eda (patch) | |
tree | 726b16f46c039df387f7cdfe0d195821d8955532 /drivers/md/raid10.c | |
parent | 8ed0a5216a0238f53b482ec88ce4aeed4b9f0da1 (diff) |
Support adding a spare to a live md array with external metadata.
i.e. extend the 'md/dev-XXX/slot' attribute so that you can
tell a device to fill an vacant slot in an and md array.
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index a71277b640ab..50ad8d2ae0e8 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1116,6 +1116,8 @@ static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1116 | int found = 0; | 1116 | int found = 0; |
1117 | int mirror; | 1117 | int mirror; |
1118 | mirror_info_t *p; | 1118 | mirror_info_t *p; |
1119 | int first = 0; | ||
1120 | int last = mddev->raid_disks - 1; | ||
1119 | 1121 | ||
1120 | if (mddev->recovery_cp < MaxSector) | 1122 | if (mddev->recovery_cp < MaxSector) |
1121 | /* only hot-add to in-sync arrays, as recovery is | 1123 | /* only hot-add to in-sync arrays, as recovery is |
@@ -1125,12 +1127,16 @@ static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1125 | if (!enough(conf)) | 1127 | if (!enough(conf)) |
1126 | return 0; | 1128 | return 0; |
1127 | 1129 | ||
1130 | if (rdev->raid_disk) | ||
1131 | first = last = rdev->raid_disk; | ||
1132 | |||
1128 | if (rdev->saved_raid_disk >= 0 && | 1133 | if (rdev->saved_raid_disk >= 0 && |
1134 | rdev->saved_raid_disk >= first && | ||
1129 | conf->mirrors[rdev->saved_raid_disk].rdev == NULL) | 1135 | conf->mirrors[rdev->saved_raid_disk].rdev == NULL) |
1130 | mirror = rdev->saved_raid_disk; | 1136 | mirror = rdev->saved_raid_disk; |
1131 | else | 1137 | else |
1132 | mirror = 0; | 1138 | mirror = first; |
1133 | for ( ; mirror < mddev->raid_disks; mirror++) | 1139 | for ( ; mirror <= last ; mirror++) |
1134 | if ( !(p=conf->mirrors+mirror)->rdev) { | 1140 | if ( !(p=conf->mirrors+mirror)->rdev) { |
1135 | 1141 | ||
1136 | blk_queue_stack_limits(mddev->queue, | 1142 | blk_queue_stack_limits(mddev->queue, |