aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid10.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-03-16 02:23:35 -0400
committerNeilBrown <neilb@suse.de>2010-05-18 01:27:47 -0400
commit84707f38e767ac470fd82af6c45a8cafe2bd1b9a (patch)
treebc480c9aeedccd735e144576284523da1406cb98 /drivers/md/raid10.c
parentc0cc75f84e0e413bce2dcabea74ef418da45c7c1 (diff)
md: don't use mddev->raid_disks in raid0 or raid10 while array is active.
In a subsequent patch we will make it possible to change mddev->raid_disks while a RAID0 or RAID10 array is active. This is part of the process of reshaping such an array. This means that we cannot use this value while processes requests (it is OK to use it during initialisation as we are locked against changes then). Both RAID0 and RAID10 have the same value stored in the private data structure, so use that value instead. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r--drivers/md/raid10.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index b90fef607f63..044c1157d98d 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -600,7 +600,7 @@ static void unplug_slaves(mddev_t *mddev)
600 int i; 600 int i;
601 601
602 rcu_read_lock(); 602 rcu_read_lock();
603 for (i=0; i<mddev->raid_disks; i++) { 603 for (i=0; i < conf->raid_disks; i++) {
604 mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); 604 mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev);
605 if (rdev && !test_bit(Faulty, &rdev->flags) && atomic_read(&rdev->nr_pending)) { 605 if (rdev && !test_bit(Faulty, &rdev->flags) && atomic_read(&rdev->nr_pending)) {
606 struct request_queue *r_queue = bdev_get_queue(rdev->bdev); 606 struct request_queue *r_queue = bdev_get_queue(rdev->bdev);
@@ -634,7 +634,7 @@ static int raid10_congested(void *data, int bits)
634 if (mddev_congested(mddev, bits)) 634 if (mddev_congested(mddev, bits))
635 return 1; 635 return 1;
636 rcu_read_lock(); 636 rcu_read_lock();
637 for (i = 0; i < mddev->raid_disks && ret == 0; i++) { 637 for (i = 0; i < conf->raid_disks && ret == 0; i++) {
638 mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); 638 mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev);
639 if (rdev && !test_bit(Faulty, &rdev->flags)) { 639 if (rdev && !test_bit(Faulty, &rdev->flags)) {
640 struct request_queue *q = bdev_get_queue(rdev->bdev); 640 struct request_queue *q = bdev_get_queue(rdev->bdev);
@@ -1131,7 +1131,7 @@ static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
1131 int mirror; 1131 int mirror;
1132 mirror_info_t *p; 1132 mirror_info_t *p;
1133 int first = 0; 1133 int first = 0;
1134 int last = mddev->raid_disks - 1; 1134 int last = conf->raid_disks - 1;
1135 1135
1136 if (mddev->recovery_cp < MaxSector) 1136 if (mddev->recovery_cp < MaxSector)
1137 /* only hot-add to in-sync arrays, as recovery is 1137 /* only hot-add to in-sync arrays, as recovery is
@@ -2139,7 +2139,7 @@ raid10_size(mddev_t *mddev, sector_t sectors, int raid_disks)
2139 conf_t *conf = mddev->private; 2139 conf_t *conf = mddev->private;
2140 2140
2141 if (!raid_disks) 2141 if (!raid_disks)
2142 raid_disks = mddev->raid_disks; 2142 raid_disks = conf->raid_disks;
2143 if (!sectors) 2143 if (!sectors)
2144 sectors = mddev->dev_sectors; 2144 sectors = mddev->dev_sectors;
2145 2145
@@ -2250,7 +2250,7 @@ static int run(mddev_t *mddev)
2250 2250
2251 list_for_each_entry(rdev, &mddev->disks, same_set) { 2251 list_for_each_entry(rdev, &mddev->disks, same_set) {
2252 disk_idx = rdev->raid_disk; 2252 disk_idx = rdev->raid_disk;
2253 if (disk_idx >= mddev->raid_disks 2253 if (disk_idx >= conf->raid_disks
2254 || disk_idx < 0) 2254 || disk_idx < 0)
2255 continue; 2255 continue;
2256 disk = conf->mirrors + disk_idx; 2256 disk = conf->mirrors + disk_idx;
@@ -2311,8 +2311,8 @@ static int run(mddev_t *mddev)
2311 mdname(mddev)); 2311 mdname(mddev));
2312 printk(KERN_INFO 2312 printk(KERN_INFO
2313 "raid10: raid set %s active with %d out of %d devices\n", 2313 "raid10: raid set %s active with %d out of %d devices\n",
2314 mdname(mddev), mddev->raid_disks - mddev->degraded, 2314 mdname(mddev), conf->raid_disks - mddev->degraded,
2315 mddev->raid_disks); 2315 conf->raid_disks);
2316 /* 2316 /*
2317 * Ok, everything is just fine now 2317 * Ok, everything is just fine now
2318 */ 2318 */
@@ -2335,7 +2335,7 @@ static int run(mddev_t *mddev)
2335 mddev->queue->backing_dev_info.ra_pages = 2* stripe; 2335 mddev->queue->backing_dev_info.ra_pages = 2* stripe;
2336 } 2336 }
2337 2337
2338 if (conf->near_copies < mddev->raid_disks) 2338 if (conf->near_copies < conf->raid_disks)
2339 blk_queue_merge_bvec(mddev->queue, raid10_mergeable_bvec); 2339 blk_queue_merge_bvec(mddev->queue, raid10_mergeable_bvec);
2340 md_integrity_register(mddev); 2340 md_integrity_register(mddev);
2341 return 0; 2341 return 0;