diff options
Diffstat (limited to 'drivers/md/linear.c')
-rw-r--r-- | drivers/md/linear.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 6a866d7c8ae5..b1eebf88c209 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -122,13 +122,13 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
122 | return NULL; | 122 | return NULL; |
123 | 123 | ||
124 | cnt = 0; | 124 | cnt = 0; |
125 | conf->array_size = 0; | 125 | conf->array_sectors = 0; |
126 | 126 | ||
127 | rdev_for_each(rdev, tmp, mddev) { | 127 | rdev_for_each(rdev, tmp, mddev) { |
128 | int j = rdev->raid_disk; | 128 | int j = rdev->raid_disk; |
129 | dev_info_t *disk = conf->disks + j; | 129 | dev_info_t *disk = conf->disks + j; |
130 | 130 | ||
131 | if (j < 0 || j > raid_disks || disk->rdev) { | 131 | if (j < 0 || j >= raid_disks || disk->rdev) { |
132 | printk("linear: disk numbering problem. Aborting!\n"); | 132 | printk("linear: disk numbering problem. Aborting!\n"); |
133 | goto out; | 133 | goto out; |
134 | } | 134 | } |
@@ -146,7 +146,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
146 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); | 146 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); |
147 | 147 | ||
148 | disk->size = rdev->size; | 148 | disk->size = rdev->size; |
149 | conf->array_size += rdev->size; | 149 | conf->array_sectors += rdev->size * 2; |
150 | 150 | ||
151 | cnt++; | 151 | cnt++; |
152 | } | 152 | } |
@@ -155,7 +155,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
155 | goto out; | 155 | goto out; |
156 | } | 156 | } |
157 | 157 | ||
158 | min_spacing = conf->array_size; | 158 | min_spacing = conf->array_sectors / 2; |
159 | sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *)); | 159 | sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *)); |
160 | 160 | ||
161 | /* min_spacing is the minimum spacing that will fit the hash | 161 | /* min_spacing is the minimum spacing that will fit the hash |
@@ -164,7 +164,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
164 | * that is larger than min_spacing as use the size of that as | 164 | * that is larger than min_spacing as use the size of that as |
165 | * the actual spacing | 165 | * the actual spacing |
166 | */ | 166 | */ |
167 | conf->hash_spacing = conf->array_size; | 167 | conf->hash_spacing = conf->array_sectors / 2; |
168 | for (i=0; i < cnt-1 ; i++) { | 168 | for (i=0; i < cnt-1 ; i++) { |
169 | sector_t sz = 0; | 169 | sector_t sz = 0; |
170 | int j; | 170 | int j; |
@@ -194,7 +194,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
194 | unsigned round; | 194 | unsigned round; |
195 | unsigned long base; | 195 | unsigned long base; |
196 | 196 | ||
197 | sz = conf->array_size >> conf->preshift; | 197 | sz = conf->array_sectors >> (conf->preshift + 1); |
198 | sz += 1; /* force round-up */ | 198 | sz += 1; /* force round-up */ |
199 | base = conf->hash_spacing >> conf->preshift; | 199 | base = conf->hash_spacing >> conf->preshift; |
200 | round = sector_div(sz, base); | 200 | round = sector_div(sz, base); |
@@ -221,7 +221,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
221 | curr_offset = 0; | 221 | curr_offset = 0; |
222 | i = 0; | 222 | i = 0; |
223 | for (curr_offset = 0; | 223 | for (curr_offset = 0; |
224 | curr_offset < conf->array_size; | 224 | curr_offset < conf->array_sectors / 2; |
225 | curr_offset += conf->hash_spacing) { | 225 | curr_offset += conf->hash_spacing) { |
226 | 226 | ||
227 | while (i < raid_disks-1 && | 227 | while (i < raid_disks-1 && |
@@ -258,7 +258,7 @@ static int linear_run (mddev_t *mddev) | |||
258 | if (!conf) | 258 | if (!conf) |
259 | return 1; | 259 | return 1; |
260 | mddev->private = conf; | 260 | mddev->private = conf; |
261 | mddev->array_size = conf->array_size; | 261 | mddev->array_sectors = conf->array_sectors; |
262 | 262 | ||
263 | blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); | 263 | blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); |
264 | mddev->queue->unplug_fn = linear_unplug; | 264 | mddev->queue->unplug_fn = linear_unplug; |
@@ -292,8 +292,8 @@ static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev) | |||
292 | newconf->prev = mddev_to_conf(mddev); | 292 | newconf->prev = mddev_to_conf(mddev); |
293 | mddev->private = newconf; | 293 | mddev->private = newconf; |
294 | mddev->raid_disks++; | 294 | mddev->raid_disks++; |
295 | mddev->array_size = newconf->array_size; | 295 | mddev->array_sectors = newconf->array_sectors; |
296 | set_capacity(mddev->gendisk, mddev->array_size << 1); | 296 | set_capacity(mddev->gendisk, mddev->array_sectors); |
297 | return 0; | 297 | return 0; |
298 | } | 298 | } |
299 | 299 | ||