aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorAndre Noll <maan@systemlinux.org>2008-07-21 03:05:25 -0400
committerNeilBrown <neilb@suse.de>2008-07-21 03:05:25 -0400
commitd6e2215052810678bc9782fd980b52706fc71f50 (patch)
tree63f355d1e072b6c4c48913e114c0154a5b08d792 /drivers/md
parentf233ea5c9e0d8b95e4283bf6a3436b88f6fd3586 (diff)
md: linear: Make array_size sector-based and rename it to array_sectors.
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/linear.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index 57644a780f16..1cafaa959443 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -120,7 +120,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
120 return NULL; 120 return NULL;
121 121
122 cnt = 0; 122 cnt = 0;
123 conf->array_size = 0; 123 conf->array_sectors = 0;
124 124
125 rdev_for_each(rdev, tmp, mddev) { 125 rdev_for_each(rdev, tmp, mddev) {
126 int j = rdev->raid_disk; 126 int j = rdev->raid_disk;
@@ -144,7 +144,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
144 blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); 144 blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9);
145 145
146 disk->size = rdev->size; 146 disk->size = rdev->size;
147 conf->array_size += rdev->size; 147 conf->array_sectors += rdev->size * 2;
148 148
149 cnt++; 149 cnt++;
150 } 150 }
@@ -153,7 +153,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
153 goto out; 153 goto out;
154 } 154 }
155 155
156 min_spacing = conf->array_size; 156 min_spacing = conf->array_sectors / 2;
157 sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *)); 157 sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *));
158 158
159 /* min_spacing is the minimum spacing that will fit the hash 159 /* min_spacing is the minimum spacing that will fit the hash
@@ -162,7 +162,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
162 * that is larger than min_spacing as use the size of that as 162 * that is larger than min_spacing as use the size of that as
163 * the actual spacing 163 * the actual spacing
164 */ 164 */
165 conf->hash_spacing = conf->array_size; 165 conf->hash_spacing = conf->array_sectors / 2;
166 for (i=0; i < cnt-1 ; i++) { 166 for (i=0; i < cnt-1 ; i++) {
167 sector_t sz = 0; 167 sector_t sz = 0;
168 int j; 168 int j;
@@ -192,7 +192,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
192 unsigned round; 192 unsigned round;
193 unsigned long base; 193 unsigned long base;
194 194
195 sz = conf->array_size >> conf->preshift; 195 sz = conf->array_sectors >> (conf->preshift + 1);
196 sz += 1; /* force round-up */ 196 sz += 1; /* force round-up */
197 base = conf->hash_spacing >> conf->preshift; 197 base = conf->hash_spacing >> conf->preshift;
198 round = sector_div(sz, base); 198 round = sector_div(sz, base);
@@ -219,7 +219,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
219 curr_offset = 0; 219 curr_offset = 0;
220 i = 0; 220 i = 0;
221 for (curr_offset = 0; 221 for (curr_offset = 0;
222 curr_offset < conf->array_size; 222 curr_offset < conf->array_sectors / 2;
223 curr_offset += conf->hash_spacing) { 223 curr_offset += conf->hash_spacing) {
224 224
225 while (i < raid_disks-1 && 225 while (i < raid_disks-1 &&
@@ -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_sectors = conf->array_size * 2; 259 mddev->array_sectors = conf->array_sectors;
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,7 +290,7 @@ 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_sectors = newconf->array_size * 2; 293 mddev->array_sectors = newconf->array_sectors;
294 set_capacity(mddev->gendisk, mddev->array_sectors); 294 set_capacity(mddev->gendisk, mddev->array_sectors);
295 return 0; 295 return 0;
296} 296}