aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-03-30 23:59:03 -0400
committerDan Williams <dan.j.williams@intel.com>2009-03-30 23:59:03 -0400
commit1f403624bde3c678a166984b1e6a727a0ce06f2b (patch)
treeb66ed37091e825bcde1cd0d333d4ebba86772805
parent80c3a6ce4ba4470379b9e6a4d9bcd9d2ee26ae03 (diff)
md: centralize ->array_sectors modifications
Get personalities out of the business of directly modifying ->array_sectors. Lays groundwork to introduce policy on when ->array_sectors can be modified. Reviewed-by: Andre Noll <maan@systemlinux.org> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--drivers/md/faulty.c2
-rw-r--r--drivers/md/linear.c4
-rw-r--r--drivers/md/md.c6
-rw-r--r--drivers/md/md.h1
-rw-r--r--drivers/md/multipath.c2
-rw-r--r--drivers/md/raid0.c2
-rw-r--r--drivers/md/raid1.c4
-rw-r--r--drivers/md/raid10.c2
-rw-r--r--drivers/md/raid5.c8
9 files changed, 20 insertions, 11 deletions
diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c
index d76c87f2a831..8695809b24b0 100644
--- a/drivers/md/faulty.c
+++ b/drivers/md/faulty.c
@@ -312,7 +312,7 @@ static int run(mddev_t *mddev)
312 list_for_each_entry(rdev, &mddev->disks, same_set) 312 list_for_each_entry(rdev, &mddev->disks, same_set)
313 conf->rdev = rdev; 313 conf->rdev = rdev;
314 314
315 mddev->array_sectors = faulty_size(mddev, 0, 0); 315 md_set_array_sectors(mddev, faulty_size(mddev, 0, 0));
316 mddev->private = conf; 316 mddev->private = conf;
317 317
318 reconfig(mddev, mddev->layout, -1); 318 reconfig(mddev, mddev->layout, -1);
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index b6bb976123da..7a36e38393a1 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -263,7 +263,7 @@ static int linear_run (mddev_t *mddev)
263 if (!conf) 263 if (!conf)
264 return 1; 264 return 1;
265 mddev->private = conf; 265 mddev->private = conf;
266 mddev->array_sectors = linear_size(mddev, 0, 0); 266 md_set_array_sectors(mddev, linear_size(mddev, 0, 0));
267 267
268 blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); 268 blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec);
269 mddev->queue->unplug_fn = linear_unplug; 269 mddev->queue->unplug_fn = linear_unplug;
@@ -297,7 +297,7 @@ static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev)
297 newconf->prev = mddev_to_conf(mddev); 297 newconf->prev = mddev_to_conf(mddev);
298 mddev->private = newconf; 298 mddev->private = newconf;
299 mddev->raid_disks++; 299 mddev->raid_disks++;
300 mddev->array_sectors = linear_size(mddev, 0, 0); 300 md_set_array_sectors(mddev, linear_size(mddev, 0, 0));
301 set_capacity(mddev->gendisk, mddev->array_sectors); 301 set_capacity(mddev->gendisk, mddev->array_sectors);
302 return 0; 302 return 0;
303} 303}
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 0689d89d263c..76ba69b31d6a 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4977,6 +4977,12 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info)
4977 return 0; 4977 return 0;
4978} 4978}
4979 4979
4980void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors)
4981{
4982 mddev->array_sectors = array_sectors;
4983}
4984EXPORT_SYMBOL(md_set_array_sectors);
4985
4980static int update_size(mddev_t *mddev, sector_t num_sectors) 4986static int update_size(mddev_t *mddev, sector_t num_sectors)
4981{ 4987{
4982 mdk_rdev_t *rdev; 4988 mdk_rdev_t *rdev;
diff --git a/drivers/md/md.h b/drivers/md/md.h
index d2c50da1ae7f..ce89dda24074 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -430,3 +430,4 @@ extern void md_do_sync(mddev_t *mddev);
430extern void md_new_event(mddev_t *mddev); 430extern void md_new_event(mddev_t *mddev);
431extern int md_allow_write(mddev_t *mddev); 431extern int md_allow_write(mddev_t *mddev);
432extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev); 432extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev);
433extern void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors);
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index a3f6d8668bb3..41ced0cbe823 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -510,7 +510,7 @@ static int multipath_run (mddev_t *mddev)
510 /* 510 /*
511 * Ok, everything is just fine now 511 * Ok, everything is just fine now
512 */ 512 */
513 mddev->array_sectors = multipath_size(mddev, 0, 0); 513 md_set_array_sectors(mddev, multipath_size(mddev, 0, 0));
514 514
515 mddev->queue->unplug_fn = multipath_unplug; 515 mddev->queue->unplug_fn = multipath_unplug;
516 mddev->queue->backing_dev_info.congested_fn = multipath_congested; 516 mddev->queue->backing_dev_info.congested_fn = multipath_congested;
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index bb0df6a18443..6f7e538c8763 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -306,7 +306,7 @@ static int raid0_run (mddev_t *mddev)
306 goto out_free_conf; 306 goto out_free_conf;
307 307
308 /* calculate array device size */ 308 /* calculate array device size */
309 mddev->array_sectors = raid0_size(mddev, 0, 0); 309 md_set_array_sectors(mddev, raid0_size(mddev, 0, 0));
310 310
311 printk(KERN_INFO "raid0 : md_size is %llu sectors.\n", 311 printk(KERN_INFO "raid0 : md_size is %llu sectors.\n",
312 (unsigned long long)mddev->array_sectors); 312 (unsigned long long)mddev->array_sectors);
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index a2a83b0d5a95..044116b53f7a 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2059,7 +2059,7 @@ static int run(mddev_t *mddev)
2059 /* 2059 /*
2060 * Ok, everything is just fine now 2060 * Ok, everything is just fine now
2061 */ 2061 */
2062 mddev->array_sectors = raid1_size(mddev, 0, 0); 2062 md_set_array_sectors(mddev, raid1_size(mddev, 0, 0));
2063 2063
2064 mddev->queue->unplug_fn = raid1_unplug; 2064 mddev->queue->unplug_fn = raid1_unplug;
2065 mddev->queue->backing_dev_info.congested_fn = raid1_congested; 2065 mddev->queue->backing_dev_info.congested_fn = raid1_congested;
@@ -2124,7 +2124,7 @@ static int raid1_resize(mddev_t *mddev, sector_t sectors)
2124 * any io in the removed space completes, but it hardly seems 2124 * any io in the removed space completes, but it hardly seems
2125 * worth it. 2125 * worth it.
2126 */ 2126 */
2127 mddev->array_sectors = raid1_size(mddev, sectors, 0); 2127 md_set_array_sectors(mddev, raid1_size(mddev, sectors, 0));
2128 set_capacity(mddev->gendisk, mddev->array_sectors); 2128 set_capacity(mddev->gendisk, mddev->array_sectors);
2129 mddev->changed = 1; 2129 mddev->changed = 1;
2130 if (mddev->array_sectors > mddev->dev_sectors && 2130 if (mddev->array_sectors > mddev->dev_sectors &&
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 5bf1b24ae802..ad153b24ea0d 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2193,7 +2193,7 @@ static int run(mddev_t *mddev)
2193 /* 2193 /*
2194 * Ok, everything is just fine now 2194 * Ok, everything is just fine now
2195 */ 2195 */
2196 mddev->array_sectors = raid10_size(mddev, 0, 0); 2196 md_set_array_sectors(mddev, raid10_size(mddev, 0, 0));
2197 mddev->resync_max_sectors = mddev->array_sectors; 2197 mddev->resync_max_sectors = mddev->array_sectors;
2198 2198
2199 mddev->queue->unplug_fn = raid10_unplug; 2199 mddev->queue->unplug_fn = raid10_unplug;
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 2cd619ff0761..2930fc26a852 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4474,7 +4474,7 @@ static int run(mddev_t *mddev)
4474 mddev->queue->backing_dev_info.congested_data = mddev; 4474 mddev->queue->backing_dev_info.congested_data = mddev;
4475 mddev->queue->backing_dev_info.congested_fn = raid5_congested; 4475 mddev->queue->backing_dev_info.congested_fn = raid5_congested;
4476 4476
4477 mddev->array_sectors = raid5_size(mddev, 0, 0); 4477 md_set_array_sectors(mddev, raid5_size(mddev, 0, 0));
4478 4478
4479 blk_queue_merge_bvec(mddev->queue, raid5_mergeable_bvec); 4479 blk_queue_merge_bvec(mddev->queue, raid5_mergeable_bvec);
4480 4480
@@ -4698,7 +4698,8 @@ static int raid5_resize(mddev_t *mddev, sector_t sectors)
4698 * worth it. 4698 * worth it.
4699 */ 4699 */
4700 sectors &= ~((sector_t)mddev->chunk_size/512 - 1); 4700 sectors &= ~((sector_t)mddev->chunk_size/512 - 1);
4701 mddev->array_sectors = raid5_size(mddev, sectors, mddev->raid_disks); 4701 md_set_array_sectors(mddev, raid5_size(mddev, sectors,
4702 mddev->raid_disks));
4702 set_capacity(mddev->gendisk, mddev->array_sectors); 4703 set_capacity(mddev->gendisk, mddev->array_sectors);
4703 mddev->changed = 1; 4704 mddev->changed = 1;
4704 if (sectors > mddev->dev_sectors && mddev->recovery_cp == MaxSector) { 4705 if (sectors > mddev->dev_sectors && mddev->recovery_cp == MaxSector) {
@@ -4836,7 +4837,8 @@ static void end_reshape(raid5_conf_t *conf)
4836 if (!test_bit(MD_RECOVERY_INTR, &conf->mddev->recovery)) { 4837 if (!test_bit(MD_RECOVERY_INTR, &conf->mddev->recovery)) {
4837 mddev_t *mddev = conf->mddev; 4838 mddev_t *mddev = conf->mddev;
4838 4839
4839 mddev->array_sectors = raid5_size(mddev, 0, conf->raid_disks); 4840 md_set_array_sectors(mddev, raid5_size(mddev, 0,
4841 conf->raid_disks));
4840 set_capacity(mddev->gendisk, mddev->array_sectors); 4842 set_capacity(mddev->gendisk, mddev->array_sectors);
4841 mddev->changed = 1; 4843 mddev->changed = 1;
4842 conf->previous_raid_disks = conf->raid_disks; 4844 conf->previous_raid_disks = conf->raid_disks;