aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/multipath.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/multipath.c')
-rw-r--r--drivers/md/multipath.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index e968116e0de9..c4779ccba1c3 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -281,13 +281,18 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
281{ 281{
282 multipath_conf_t *conf = mddev->private; 282 multipath_conf_t *conf = mddev->private;
283 struct request_queue *q; 283 struct request_queue *q;
284 int found = 0; 284 int err = -EEXIST;
285 int path; 285 int path;
286 struct multipath_info *p; 286 struct multipath_info *p;
287 int first = 0;
288 int last = mddev->raid_disks - 1;
289
290 if (rdev->raid_disk >= 0)
291 first = last = rdev->raid_disk;
287 292
288 print_multipath_conf(conf); 293 print_multipath_conf(conf);
289 294
290 for (path=0; path<mddev->raid_disks; path++) 295 for (path = first; path <= last; path++)
291 if ((p=conf->multipaths+path)->rdev == NULL) { 296 if ((p=conf->multipaths+path)->rdev == NULL) {
292 q = rdev->bdev->bd_disk->queue; 297 q = rdev->bdev->bd_disk->queue;
293 blk_queue_stack_limits(mddev->queue, q); 298 blk_queue_stack_limits(mddev->queue, q);
@@ -307,11 +312,13 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
307 rdev->raid_disk = path; 312 rdev->raid_disk = path;
308 set_bit(In_sync, &rdev->flags); 313 set_bit(In_sync, &rdev->flags);
309 rcu_assign_pointer(p->rdev, rdev); 314 rcu_assign_pointer(p->rdev, rdev);
310 found = 1; 315 err = 0;
316 break;
311 } 317 }
312 318
313 print_multipath_conf(conf); 319 print_multipath_conf(conf);
314 return found; 320
321 return err;
315} 322}
316 323
317static int multipath_remove_disk(mddev_t *mddev, int number) 324static int multipath_remove_disk(mddev_t *mddev, int number)
@@ -497,7 +504,7 @@ static int multipath_run (mddev_t *mddev)
497 /* 504 /*
498 * Ok, everything is just fine now 505 * Ok, everything is just fine now
499 */ 506 */
500 mddev->array_size = mddev->size; 507 mddev->array_sectors = mddev->size * 2;
501 508
502 mddev->queue->unplug_fn = multipath_unplug; 509 mddev->queue->unplug_fn = multipath_unplug;
503 mddev->queue->backing_dev_info.congested_fn = multipath_congested; 510 mddev->queue->backing_dev_info.congested_fn = multipath_congested;