aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/linear.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/linear.c')
-rw-r--r--drivers/md/linear.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index d5ecd2d53046..192741083196 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -139,8 +139,6 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
139 if (!conf) 139 if (!conf)
140 return NULL; 140 return NULL;
141 141
142 mddev->private = conf;
143
144 cnt = 0; 142 cnt = 0;
145 conf->array_size = 0; 143 conf->array_size = 0;
146 144
@@ -232,7 +230,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
232 * First calculate the device offsets. 230 * First calculate the device offsets.
233 */ 231 */
234 conf->disks[0].offset = 0; 232 conf->disks[0].offset = 0;
235 for (i=1; i<mddev->raid_disks; i++) 233 for (i = 1; i < raid_disks; i++)
236 conf->disks[i].offset = 234 conf->disks[i].offset =
237 conf->disks[i-1].offset + 235 conf->disks[i-1].offset +
238 conf->disks[i-1].size; 236 conf->disks[i-1].size;
@@ -244,7 +242,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
244 curr_offset < conf->array_size; 242 curr_offset < conf->array_size;
245 curr_offset += conf->hash_spacing) { 243 curr_offset += conf->hash_spacing) {
246 244
247 while (i < mddev->raid_disks-1 && 245 while (i < raid_disks-1 &&
248 curr_offset >= conf->disks[i+1].offset) 246 curr_offset >= conf->disks[i+1].offset)
249 i++; 247 i++;
250 248
@@ -299,9 +297,11 @@ static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev)
299 */ 297 */
300 linear_conf_t *newconf; 298 linear_conf_t *newconf;
301 299
302 if (rdev->raid_disk != mddev->raid_disks) 300 if (rdev->saved_raid_disk != mddev->raid_disks)
303 return -EINVAL; 301 return -EINVAL;
304 302
303 rdev->raid_disk = rdev->saved_raid_disk;
304
305 newconf = linear_conf(mddev,mddev->raid_disks+1); 305 newconf = linear_conf(mddev,mddev->raid_disks+1);
306 306
307 if (!newconf) 307 if (!newconf)