]> err.no Git - linux-2.6/commitdiff
md: Make mddev->array_size sector-based.
authorAndre Noll <maan@systemlinux.org>
Mon, 21 Jul 2008 07:05:22 +0000 (17:05 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 21 Jul 2008 07:05:22 +0000 (17:05 +1000)
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>
drivers/md/faulty.c
drivers/md/linear.c
drivers/md/md.c
drivers/md/multipath.c
drivers/md/raid0.c
drivers/md/raid1.c
drivers/md/raid10.c
drivers/md/raid5.c
include/linux/raid/md_k.h

index d107ddceefcd4651eabaca68f34cf608c4046a56..268547dbfbd30ce2942b3b5d92c9bbfab793d4b7 100644 (file)
@@ -297,7 +297,7 @@ static int run(mddev_t *mddev)
        rdev_for_each(rdev, tmp, mddev)
                conf->rdev = rdev;
 
-       mddev->array_size = mddev->size;
+       mddev->array_sectors = mddev->size * 2;
        mddev->private = conf;
 
        reconfig(mddev, mddev->layout, -1);
index ec921f58fbb8224cec0772494a75926fbc660be7..57644a780f1695693855d40a2b7c690f47515b51 100644 (file)
@@ -256,7 +256,7 @@ static int linear_run (mddev_t *mddev)
        if (!conf)
                return 1;
        mddev->private = conf;
-       mddev->array_size = conf->array_size;
+       mddev->array_sectors = conf->array_size * 2;
 
        blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec);
        mddev->queue->unplug_fn = linear_unplug;
@@ -290,8 +290,8 @@ static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev)
        newconf->prev = mddev_to_conf(mddev);
        mddev->private = newconf;
        mddev->raid_disks++;
-       mddev->array_size = newconf->array_size;
-       set_capacity(mddev->gendisk, mddev->array_size << 1);
+       mddev->array_sectors = newconf->array_size * 2;
+       set_capacity(mddev->gendisk, mddev->array_sectors);
        return 0;
 }
 
index df13a17a96273b07c282e1c0fbaab86d1c697d45..4bfbc1982cda977ff28ee312fe0a84372b0a833d 100644 (file)
@@ -3704,7 +3704,7 @@ static int do_md_run(mddev_t * mddev)
        if (mddev->flags)
                md_update_sb(mddev, 0);
 
-       set_capacity(disk, mddev->array_size<<1);
+       set_capacity(disk, mddev->array_sectors);
 
        /* If we call blk_queue_make_request here, it will
         * 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)
 
                export_array(mddev);
 
-               mddev->array_size = 0;
+               mddev->array_sectors = 0;
                mddev->size = 0;
                mddev->raid_disks = 0;
                mddev->recovery_cp = 0;
@@ -4644,7 +4644,8 @@ static int update_size(mddev_t *mddev, sector_t num_sectors)
                bdev = bdget_disk(mddev->gendisk, 0);
                if (bdev) {
                        mutex_lock(&bdev->bd_inode->i_mutex);
-                       i_size_write(bdev->bd_inode, (loff_t)mddev->array_size << 10);
+                       i_size_write(bdev->bd_inode,
+                                    (loff_t)mddev->array_sectors << 9);
                        mutex_unlock(&bdev->bd_inode->i_mutex);
                        bdput(bdev);
                }
@@ -5391,10 +5392,11 @@ static int md_seq_show(struct seq_file *seq, void *v)
                if (!list_empty(&mddev->disks)) {
                        if (mddev->pers)
                                seq_printf(seq, "\n      %llu blocks",
-                                       (unsigned long long)mddev->array_size);
+                                          (unsigned long long)
+                                          mddev->array_sectors / 2);
                        else
                                seq_printf(seq, "\n      %llu blocks",
-                                       (unsigned long long)size);
+                                          (unsigned long long)size);
                }
                if (mddev->persistent) {
                        if (mddev->major_version != 0 ||
index 541cbe3414bd29dc2e0260b322b3a45fa3d04c55..c4779ccba1c39bf1ab3f7454706868245f95ea0e 100644 (file)
@@ -504,7 +504,7 @@ static int multipath_run (mddev_t *mddev)
        /*
         * Ok, everything is just fine now
         */
-       mddev->array_size = mddev->size;
+       mddev->array_sectors = mddev->size * 2;
 
        mddev->queue->unplug_fn = multipath_unplug;
        mddev->queue->backing_dev_info.congested_fn = multipath_congested;
index 914c04ddec7c64690cdb24a4b77c83172d4d38ab..2f30ebd8b7abca91da2ae5a72ae825d4a8cb726e 100644 (file)
@@ -293,16 +293,16 @@ static int raid0_run (mddev_t *mddev)
                goto out_free_conf;
 
        /* calculate array device size */
-       mddev->array_size = 0;
+       mddev->array_sectors = 0;
        rdev_for_each(rdev, tmp, mddev)
-               mddev->array_size += rdev->size;
+               mddev->array_sectors += rdev->size * 2;
 
        printk("raid0 : md_size is %llu blocks.\n", 
-               (unsigned long long)mddev->array_size);
+               (unsigned long long)mddev->array_sectors / 2);
        printk("raid0 : conf->hash_spacing is %llu blocks.\n",
                (unsigned long long)conf->hash_spacing);
        {
-               sector_t s = mddev->array_size;
+               sector_t s = mddev->array_sectors / 2;
                sector_t space = conf->hash_spacing;
                int round;
                conf->preshift = 0;
index 491dc2d4ad5fe7dc81c95bfb168e97d98a67a95d..03a5ab705c20dcb482a98472d88b9e4d9d0d0a5d 100644 (file)
@@ -2043,7 +2043,7 @@ static int run(mddev_t *mddev)
        /*
         * Ok, everything is just fine now
         */
-       mddev->array_size = mddev->size;
+       mddev->array_sectors = mddev->size * 2;
 
        mddev->queue->unplug_fn = raid1_unplug;
        mddev->queue->backing_dev_info.congested_fn = raid1_congested;
@@ -2105,14 +2105,15 @@ static int raid1_resize(mddev_t *mddev, sector_t sectors)
         * any io in the removed space completes, but it hardly seems
         * worth it.
         */
-       mddev->array_size = sectors>>1;
-       set_capacity(mddev->gendisk, mddev->array_size << 1);
+       mddev->array_sectors = sectors;
+       set_capacity(mddev->gendisk, mddev->array_sectors);
        mddev->changed = 1;
-       if (mddev->array_size > mddev->size && mddev->recovery_cp == MaxSector) {
+       if (mddev->array_sectors / 2 > mddev->size &&
+           mddev->recovery_cp == MaxSector) {
                mddev->recovery_cp = mddev->size << 1;
                set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
        }
-       mddev->size = mddev->array_size;
+       mddev->size = mddev->array_sectors / 2;
        mddev->resync_max_sectors = sectors;
        return 0;
 }
index df08a9fa3a1fc8c694f42a1a626736709f8b808d..2acea4025243885d2df685b29a47bc8b48ab89fd 100644 (file)
@@ -2164,7 +2164,7 @@ static int run(mddev_t *mddev)
        /*
         * Ok, everything is just fine now
         */
-       mddev->array_size = size << (conf->chunk_shift-1);
+       mddev->array_sectors = size << conf->chunk_shift;
        mddev->resync_max_sectors = size << conf->chunk_shift;
 
        mddev->queue->unplug_fn = raid10_unplug;
index 8f4c70a5321067a21d780eb60b8d47ed5a8082ab..42a480ba767b6d2618aaba1be2cd3d78970b66f0 100644 (file)
@@ -3540,7 +3540,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped
                            j == raid6_next_disk(sh->pd_idx, sh->disks))
                                continue;
                        s = compute_blocknr(sh, j);
-                       if (s < (mddev->array_size<<1)) {
+                       if (s < mddev->array_sectors) {
                                skipped = 1;
                                continue;
                        }
@@ -4189,7 +4189,7 @@ static int run(mddev_t *mddev)
        mddev->queue->backing_dev_info.congested_data = mddev;
        mddev->queue->backing_dev_info.congested_fn = raid5_congested;
 
-       mddev->array_size =  mddev->size * (conf->previous_raid_disks -
+       mddev->array_sectors = 2 * mddev->size * (conf->previous_raid_disks -
                                            conf->max_degraded);
 
        blk_queue_merge_bvec(mddev->queue, raid5_mergeable_bvec);
@@ -4413,8 +4413,9 @@ static int raid5_resize(mddev_t *mddev, sector_t sectors)
        raid5_conf_t *conf = mddev_to_conf(mddev);
 
        sectors &= ~((sector_t)mddev->chunk_size/512 - 1);
-       mddev->array_size = (sectors * (mddev->raid_disks-conf->max_degraded))>>1;
-       set_capacity(mddev->gendisk, mddev->array_size << 1);
+       mddev->array_sectors = sectors * (mddev->raid_disks
+                                         - conf->max_degraded);
+       set_capacity(mddev->gendisk, mddev->array_sectors);
        mddev->changed = 1;
        if (sectors/2  > mddev->size && mddev->recovery_cp == MaxSector) {
                mddev->recovery_cp = mddev->size << 1;
@@ -4547,15 +4548,16 @@ static void end_reshape(raid5_conf_t *conf)
        struct block_device *bdev;
 
        if (!test_bit(MD_RECOVERY_INTR, &conf->mddev->recovery)) {
-               conf->mddev->array_size = conf->mddev->size *
+               conf->mddev->array_sectors = 2 * conf->mddev->size *
                        (conf->raid_disks - conf->max_degraded);
-               set_capacity(conf->mddev->gendisk, conf->mddev->array_size << 1);
+               set_capacity(conf->mddev->gendisk, conf->mddev->array_sectors);
                conf->mddev->changed = 1;
 
                bdev = bdget_disk(conf->mddev->gendisk, 0);
                if (bdev) {
                        mutex_lock(&bdev->bd_inode->i_mutex);
-                       i_size_write(bdev->bd_inode, (loff_t)conf->mddev->array_size << 10);
+                       i_size_write(bdev->bd_inode,
+                                    (loff_t)conf->mddev->array_sectors << 9);
                        mutex_unlock(&bdev->bd_inode->i_mutex);
                        bdput(bdev);
                }
index e37aaa41efc66e176e5d8ba35a343c4962d29492..6f72b47ae41c0aa29c163647f2bbc54b1ba85120 100644 (file)
@@ -150,7 +150,7 @@ struct mddev_s
        int                             raid_disks;
        int                             max_disks;
        sector_t                        size; /* used size of component devices */
-       sector_t                        array_size; /* exported array size */
+       sector_t                        array_sectors; /* exported array size */
        __u64                           events;
 
        char                            uuid[16];