aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorAndre Noll <maan@systemlinux.org>2008-07-21 03:05:22 -0400
committerNeilBrown <neilb@suse.de>2008-07-21 03:05:22 -0400
commitf233ea5c9e0d8b95e4283bf6a3436b88f6fd3586 (patch)
tree8a36b621de46da23f3957c6e3ea4d653c2937544 /drivers/md
parent15f4a5fdf3aa07b53f6a7969664741db5882e485 (diff)
md: Make mddev->array_size sector-based.
This patch renames the array_size field of struct mddev_s to array_sectors and converts all instances to use units of 512 byte sectors instead of 1k blocks. Signed-off-by: Andre Noll <maan@systemlinux.org> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/faulty.c2
-rw-r--r--drivers/md/linear.c6
-rw-r--r--drivers/md/md.c12
-rw-r--r--drivers/md/multipath.c2
-rw-r--r--drivers/md/raid0.c8
-rw-r--r--drivers/md/raid1.c11
-rw-r--r--drivers/md/raid10.c2
-rw-r--r--drivers/md/raid5.c16
8 files changed, 32 insertions, 27 deletions
diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c
index d107ddceefcd..268547dbfbd3 100644
--- a/drivers/md/faulty.c
+++ b/drivers/md/faulty.c
@@ -297,7 +297,7 @@ static int run(mddev_t *mddev)
297 rdev_for_each(rdev, tmp, mddev) 297 rdev_for_each(rdev, tmp, mddev)
298 conf->rdev = rdev; 298 conf->rdev = rdev;
299 299
300 mddev->array_size = mddev->size; 300 mddev->array_sectors = mddev->size * 2;
301 mddev->private = conf; 301 mddev->private = conf;
302 302
303 reconfig(mddev, mddev->layout, -1); 303 reconfig(mddev, mddev->layout, -1);
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index ec921f58fbb8..57644a780f16 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -256,7 +256,7 @@ static int linear_run (mddev_t *mddev)
256 if (!conf) 256 if (!conf)
257 return 1; 257 return 1;
258 mddev->private = conf; 258 mddev->private = conf;
259 mddev->array_size = conf->array_size; 259 mddev->array_sectors = conf->array_size * 2;
260 260
261 blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); 261 blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec);
262 mddev->queue->unplug_fn = linear_unplug; 262 mddev->queue->unplug_fn = linear_unplug;
@@ -290,8 +290,8 @@ static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev)
290 newconf->prev = mddev_to_conf(mddev); 290 newconf->prev = mddev_to_conf(mddev);
291 mddev->private = newconf; 291 mddev->private = newconf;
292 mddev->raid_disks++; 292 mddev->raid_disks++;
293 mddev->array_size = newconf->array_size; 293 mddev->array_sectors = newconf->array_size * 2;
294 set_capacity(mddev->gendisk, mddev->array_size << 1); 294 set_capacity(mddev->gendisk, mddev->array_sectors);
295 return 0; 295 return 0;
296} 296}
297 297
diff --git a/drivers/md/md.c b/drivers/md/md.c
index df13a17a9627..4bfbc1982cda 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3704,7 +3704,7 @@ static int do_md_run(mddev_t * mddev)
3704 if (mddev->flags) 3704 if (mddev->flags)
3705 md_update_sb(mddev, 0); 3705 md_update_sb(mddev, 0);
3706 3706
3707 set_capacity(disk, mddev->array_size<<1); 3707 set_capacity(disk, mddev->array_sectors);
3708 3708
3709 /* If we call blk_queue_make_request here, it will 3709 /* If we call blk_queue_make_request here, it will
3710 * re-initialise max_sectors etc which may have been 3710 * re-initialise max_sectors etc which may have been
@@ -3905,7 +3905,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
3905 3905
3906 export_array(mddev); 3906 export_array(mddev);
3907 3907
3908 mddev->array_size = 0; 3908 mddev->array_sectors = 0;
3909 mddev->size = 0; 3909 mddev->size = 0;
3910 mddev->raid_disks = 0; 3910 mddev->raid_disks = 0;
3911 mddev->recovery_cp = 0; 3911 mddev->recovery_cp = 0;
@@ -4644,7 +4644,8 @@ static int update_size(mddev_t *mddev, sector_t num_sectors)
4644 bdev = bdget_disk(mddev->gendisk, 0); 4644 bdev = bdget_disk(mddev->gendisk, 0);
4645 if (bdev) { 4645 if (bdev) {
4646 mutex_lock(&bdev->bd_inode->i_mutex); 4646 mutex_lock(&bdev->bd_inode->i_mutex);
4647 i_size_write(bdev->bd_inode, (loff_t)mddev->array_size << 10); 4647 i_size_write(bdev->bd_inode,
4648 (loff_t)mddev->array_sectors << 9);
4648 mutex_unlock(&bdev->bd_inode->i_mutex); 4649 mutex_unlock(&bdev->bd_inode->i_mutex);
4649 bdput(bdev); 4650 bdput(bdev);
4650 } 4651 }
@@ -5391,10 +5392,11 @@ static int md_seq_show(struct seq_file *seq, void *v)
5391 if (!list_empty(&mddev->disks)) { 5392 if (!list_empty(&mddev->disks)) {
5392 if (mddev->pers) 5393 if (mddev->pers)
5393 seq_printf(seq, "\n %llu blocks", 5394 seq_printf(seq, "\n %llu blocks",
5394 (unsigned long long)mddev->array_size); 5395 (unsigned long long)
5396 mddev->array_sectors / 2);
5395 else 5397 else
5396 seq_printf(seq, "\n %llu blocks", 5398 seq_printf(seq, "\n %llu blocks",
5397 (unsigned long long)size); 5399 (unsigned long long)size);
5398 } 5400 }
5399 if (mddev->persistent) { 5401 if (mddev->persistent) {
5400 if (mddev->major_version != 0 || 5402 if (mddev->major_version != 0 ||
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index 541cbe3414bd..c4779ccba1c3 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -504,7 +504,7 @@ static int multipath_run (mddev_t *mddev)
504 /* 504 /*
505 * Ok, everything is just fine now 505 * Ok, everything is just fine now
506 */ 506 */
507 mddev->array_size = mddev->size; 507 mddev->array_sectors = mddev->size * 2;
508 508
509 mddev->queue->unplug_fn = multipath_unplug; 509 mddev->queue->unplug_fn = multipath_unplug;
510 mddev->queue->backing_dev_info.congested_fn = multipath_congested; 510 mddev->queue->backing_dev_info.congested_fn = multipath_congested;
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 914c04ddec7c..2f30ebd8b7ab 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -293,16 +293,16 @@ static int raid0_run (mddev_t *mddev)
293 goto out_free_conf; 293 goto out_free_conf;
294 294
295 /* calculate array device size */ 295 /* calculate array device size */
296 mddev->array_size = 0; 296 mddev->array_sectors = 0;
297 rdev_for_each(rdev, tmp, mddev) 297 rdev_for_each(rdev, tmp, mddev)
298 mddev->array_size += rdev->size; 298 mddev->array_sectors += rdev->size * 2;
299 299
300 printk("raid0 : md_size is %llu blocks.\n", 300 printk("raid0 : md_size is %llu blocks.\n",
301 (unsigned long long)mddev->array_size); 301 (unsigned long long)mddev->array_sectors / 2);
302 printk("raid0 : conf->hash_spacing is %llu blocks.\n", 302 printk("raid0 : conf->hash_spacing is %llu blocks.\n",
303 (unsigned long long)conf->hash_spacing); 303 (unsigned long long)conf->hash_spacing);
304 { 304 {
305 sector_t s = mddev->array_size; 305 sector_t s = mddev->array_sectors / 2;
306 sector_t space = conf->hash_spacing; 306 sector_t space = conf->hash_spacing;
307 int round; 307 int round;
308 conf->preshift = 0; 308 conf->preshift = 0;
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 491dc2d4ad5f..03a5ab705c20 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2043,7 +2043,7 @@ static int run(mddev_t *mddev)
2043 /* 2043 /*
2044 * Ok, everything is just fine now 2044 * Ok, everything is just fine now
2045 */ 2045 */
2046 mddev->array_size = mddev->size; 2046 mddev->array_sectors = mddev->size * 2;
2047 2047
2048 mddev->queue->unplug_fn = raid1_unplug; 2048 mddev->queue->unplug_fn = raid1_unplug;
2049 mddev->queue->backing_dev_info.congested_fn = raid1_congested; 2049 mddev->queue->backing_dev_info.congested_fn = raid1_congested;
@@ -2105,14 +2105,15 @@ static int raid1_resize(mddev_t *mddev, sector_t sectors)
2105 * any io in the removed space completes, but it hardly seems 2105 * any io in the removed space completes, but it hardly seems
2106 * worth it. 2106 * worth it.
2107 */ 2107 */
2108 mddev->array_size = sectors>>1; 2108 mddev->array_sectors = sectors;
2109 set_capacity(mddev->gendisk, mddev->array_size << 1); 2109 set_capacity(mddev->gendisk, mddev->array_sectors);
2110 mddev->changed = 1; 2110 mddev->changed = 1;
2111 if (mddev->array_size > mddev->size && mddev->recovery_cp == MaxSector) { 2111 if (mddev->array_sectors / 2 > mddev->size &&
2112 mddev->recovery_cp == MaxSector) {
2112 mddev->recovery_cp = mddev->size << 1; 2113 mddev->recovery_cp = mddev->size << 1;
2113 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 2114 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
2114 } 2115 }
2115 mddev->size = mddev->array_size; 2116 mddev->size = mddev->array_sectors / 2;
2116 mddev->resync_max_sectors = sectors; 2117 mddev->resync_max_sectors = sectors;
2117 return 0; 2118 return 0;
2118} 2119}
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index df08a9fa3a1f..2acea4025243 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2164,7 +2164,7 @@ static int run(mddev_t *mddev)
2164 /* 2164 /*
2165 * Ok, everything is just fine now 2165 * Ok, everything is just fine now
2166 */ 2166 */
2167 mddev->array_size = size << (conf->chunk_shift-1); 2167 mddev->array_sectors = size << conf->chunk_shift;
2168 mddev->resync_max_sectors = size << conf->chunk_shift; 2168 mddev->resync_max_sectors = size << conf->chunk_shift;
2169 2169
2170 mddev->queue->unplug_fn = raid10_unplug; 2170 mddev->queue->unplug_fn = raid10_unplug;
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 8f4c70a53210..42a480ba767b 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3540,7 +3540,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped
3540 j == raid6_next_disk(sh->pd_idx, sh->disks)) 3540 j == raid6_next_disk(sh->pd_idx, sh->disks))
3541 continue; 3541 continue;
3542 s = compute_blocknr(sh, j); 3542 s = compute_blocknr(sh, j);
3543 if (s < (mddev->array_size<<1)) { 3543 if (s < mddev->array_sectors) {
3544 skipped = 1; 3544 skipped = 1;
3545 continue; 3545 continue;
3546 } 3546 }
@@ -4189,7 +4189,7 @@ static int run(mddev_t *mddev)
4189 mddev->queue->backing_dev_info.congested_data = mddev; 4189 mddev->queue->backing_dev_info.congested_data = mddev;
4190 mddev->queue->backing_dev_info.congested_fn = raid5_congested; 4190 mddev->queue->backing_dev_info.congested_fn = raid5_congested;
4191 4191
4192 mddev->array_size = mddev->size * (conf->previous_raid_disks - 4192 mddev->array_sectors = 2 * mddev->size * (conf->previous_raid_disks -
4193 conf->max_degraded); 4193 conf->max_degraded);
4194 4194
4195 blk_queue_merge_bvec(mddev->queue, raid5_mergeable_bvec); 4195 blk_queue_merge_bvec(mddev->queue, raid5_mergeable_bvec);
@@ -4413,8 +4413,9 @@ static int raid5_resize(mddev_t *mddev, sector_t sectors)
4413 raid5_conf_t *conf = mddev_to_conf(mddev); 4413 raid5_conf_t *conf = mddev_to_conf(mddev);
4414 4414
4415 sectors &= ~((sector_t)mddev->chunk_size/512 - 1); 4415 sectors &= ~((sector_t)mddev->chunk_size/512 - 1);
4416 mddev->array_size = (sectors * (mddev->raid_disks-conf->max_degraded))>>1; 4416 mddev->array_sectors = sectors * (mddev->raid_disks
4417 set_capacity(mddev->gendisk, mddev->array_size << 1); 4417 - conf->max_degraded);
4418 set_capacity(mddev->gendisk, mddev->array_sectors);
4418 mddev->changed = 1; 4419 mddev->changed = 1;
4419 if (sectors/2 > mddev->size && mddev->recovery_cp == MaxSector) { 4420 if (sectors/2 > mddev->size && mddev->recovery_cp == MaxSector) {
4420 mddev->recovery_cp = mddev->size << 1; 4421 mddev->recovery_cp = mddev->size << 1;
@@ -4547,15 +4548,16 @@ static void end_reshape(raid5_conf_t *conf)
4547 struct block_device *bdev; 4548 struct block_device *bdev;
4548 4549
4549 if (!test_bit(MD_RECOVERY_INTR, &conf->mddev->recovery)) { 4550 if (!test_bit(MD_RECOVERY_INTR, &conf->mddev->recovery)) {
4550 conf->mddev->array_size = conf->mddev->size * 4551 conf->mddev->array_sectors = 2 * conf->mddev->size *
4551 (conf->raid_disks - conf->max_degraded); 4552 (conf->raid_disks - conf->max_degraded);
4552 set_capacity(conf->mddev->gendisk, conf->mddev->array_size << 1); 4553 set_capacity(conf->mddev->gendisk, conf->mddev->array_sectors);
4553 conf->mddev->changed = 1; 4554 conf->mddev->changed = 1;
4554 4555
4555 bdev = bdget_disk(conf->mddev->gendisk, 0); 4556 bdev = bdget_disk(conf->mddev->gendisk, 0);
4556 if (bdev) { 4557 if (bdev) {
4557 mutex_lock(&bdev->bd_inode->i_mutex); 4558 mutex_lock(&bdev->bd_inode->i_mutex);
4558 i_size_write(bdev->bd_inode, (loff_t)conf->mddev->array_size << 10); 4559 i_size_write(bdev->bd_inode,
4560 (loff_t)conf->mddev->array_sectors << 9);
4559 mutex_unlock(&bdev->bd_inode->i_mutex); 4561 mutex_unlock(&bdev->bd_inode->i_mutex);
4560 bdput(bdev); 4562 bdput(bdev);
4561 } 4563 }