diff options
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, |