aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/multipath.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-21 13:29:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-21 13:29:12 -0400
commit8a392625b665c676a77c62f8608d10ff430bcb83 (patch)
tree4000a65d61baed73200e47f91dea5263ed16edd0 /drivers/md/multipath.c
parent519f0141f1c42e2b8b59c7dea005cbf6095358e8 (diff)
parent4b80991c6cb9efa607bc4fd6f3ecdf5511c31bb0 (diff)
Merge branch 'for-linus' of git://neil.brown.name/md
* 'for-linus' of git://neil.brown.name/md: (52 commits) md: Protect access to mddev->disks list using RCU md: only count actual openers as access which prevent a 'stop' md: linear: Make array_size sector-based and rename it to array_sectors. md: Make mddev->array_size sector-based. md: Make super_type->rdev_size_change() take sector-based sizes. md: Fix check for overlapping devices. md: Tidy up rdev_size_store a bit: md: Remove some unused macros. md: Turn rdev->sb_offset into a sector-based quantity. md: Make calc_dev_sboffset() return a sector count. md: Replace calc_dev_size() by calc_num_sectors(). md: Make update_size() take the number of sectors. md: Better control of when do_md_stop is allowed to stop the array. md: get_disk_info(): Don't convert between signed and unsigned and back. md: Simplify restart_array(). md: alloc_disk_sb(): Return proper error value. md: Simplify sb_equal(). md: Simplify uuid_equal(). md: sb_equal(): Fix misleading printk. md: Fix a typo in the comment to cmd_match(). ...
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;