aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/raid0.c26
-rw-r--r--include/linux/raid/raid0.h2
2 files changed, 14 insertions, 14 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index c759436b5d84..6e85e88bbae9 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -156,11 +156,11 @@ static int create_strip_zones (mddev_t *mddev)
156 goto abort; 156 goto abort;
157 } 157 }
158 zone->nb_dev = cnt; 158 zone->nb_dev = cnt;
159 zone->size = smallest->size * cnt; 159 zone->sectors = smallest->size * cnt * 2;
160 zone->zone_start = 0; 160 zone->zone_start = 0;
161 161
162 current_start = smallest->size * 2; 162 current_start = smallest->size * 2;
163 curr_zone_start = zone->size * 2; 163 curr_zone_start = zone->sectors;
164 164
165 /* now do the other zones */ 165 /* now do the other zones */
166 for (i = 1; i < conf->nr_strip_zones; i++) 166 for (i = 1; i < conf->nr_strip_zones; i++)
@@ -193,12 +193,12 @@ static int create_strip_zones (mddev_t *mddev)
193 } 193 }
194 194
195 zone->nb_dev = c; 195 zone->nb_dev = c;
196 zone->size = (smallest->size - current_start / 2) * c; 196 zone->sectors = (smallest->size * 2 - current_start) * c;
197 printk(KERN_INFO "raid0: zone->nb_dev: %d, size: %llu\n", 197 printk(KERN_INFO "raid0: zone->nb_dev: %d, sectors: %llu\n",
198 zone->nb_dev, (unsigned long long)zone->size); 198 zone->nb_dev, (unsigned long long)zone->sectors);
199 199
200 zone->zone_start = curr_zone_start; 200 zone->zone_start = curr_zone_start;
201 curr_zone_start += zone->size * 2; 201 curr_zone_start += zone->sectors;
202 202
203 current_start = smallest->size * 2; 203 current_start = smallest->size * 2;
204 printk(KERN_INFO "raid0: current zone start: %llu\n", 204 printk(KERN_INFO "raid0: current zone start: %llu\n",
@@ -220,7 +220,7 @@ static int create_strip_zones (mddev_t *mddev)
220 sector_t sz = 0; 220 sector_t sz = 0;
221 for (j=i; j<conf->nr_strip_zones-1 && 221 for (j=i; j<conf->nr_strip_zones-1 &&
222 sz < min_spacing ; j++) 222 sz < min_spacing ; j++)
223 sz += conf->strip_zone[j].size; 223 sz += conf->strip_zone[j].sectors / 2;
224 if (sz >= min_spacing && sz < conf->hash_spacing) 224 if (sz >= min_spacing && sz < conf->hash_spacing)
225 conf->hash_spacing = sz; 225 conf->hash_spacing = sz;
226 } 226 }
@@ -325,13 +325,13 @@ static int raid0_run (mddev_t *mddev)
325 conf->hash_table = kmalloc (sizeof (struct strip_zone *)*nb_zone, GFP_KERNEL); 325 conf->hash_table = kmalloc (sizeof (struct strip_zone *)*nb_zone, GFP_KERNEL);
326 if (!conf->hash_table) 326 if (!conf->hash_table)
327 goto out_free_conf; 327 goto out_free_conf;
328 size = conf->strip_zone[cur].size; 328 size = conf->strip_zone[cur].sectors / 2;
329 329
330 conf->hash_table[0] = conf->strip_zone + cur; 330 conf->hash_table[0] = conf->strip_zone + cur;
331 for (i=1; i< nb_zone; i++) { 331 for (i=1; i< nb_zone; i++) {
332 while (size <= conf->hash_spacing) { 332 while (size <= conf->hash_spacing) {
333 cur++; 333 cur++;
334 size += conf->strip_zone[cur].size; 334 size += conf->strip_zone[cur].sectors / 2;
335 } 335 }
336 size -= conf->hash_spacing; 336 size -= conf->hash_spacing;
337 conf->hash_table[i] = conf->strip_zone + cur; 337 conf->hash_table[i] = conf->strip_zone + cur;
@@ -439,10 +439,10 @@ static int raid0_make_request (struct request_queue *q, struct bio *bio)
439 sector_div(x, (u32)conf->hash_spacing); 439 sector_div(x, (u32)conf->hash_spacing);
440 zone = conf->hash_table[x]; 440 zone = conf->hash_table[x];
441 } 441 }
442 442
443 while (sector / 2 >= (zone->zone_start / 2 + zone->size)) 443 while (sector >= zone->zone_start + zone->sectors)
444 zone++; 444 zone++;
445 445
446 sect_in_chunk = bio->bi_sector & (chunk_sects - 1); 446 sect_in_chunk = bio->bi_sector & (chunk_sects - 1);
447 447
448 448
@@ -495,7 +495,7 @@ static void raid0_status (struct seq_file *seq, mddev_t *mddev)
495 seq_printf(seq, "] zs=%d ds=%d s=%d\n", 495 seq_printf(seq, "] zs=%d ds=%d s=%d\n",
496 conf->strip_zone[j].zone_start, 496 conf->strip_zone[j].zone_start,
497 conf->strip_zone[j].dev_start, 497 conf->strip_zone[j].dev_start,
498 conf->strip_zone[j].size); 498 conf->strip_zone[j].sectors);
499 } 499 }
500#endif 500#endif
501 seq_printf(seq, " %dk chunks", mddev->chunk_size/1024); 501 seq_printf(seq, " %dk chunks", mddev->chunk_size/1024);
diff --git a/include/linux/raid/raid0.h b/include/linux/raid/raid0.h
index eaf4f6ac55f6..c12521d027e2 100644
--- a/include/linux/raid/raid0.h
+++ b/include/linux/raid/raid0.h
@@ -7,7 +7,7 @@ struct strip_zone
7{ 7{
8 sector_t zone_start; /* Zone offset in md_dev (in sectors) */ 8 sector_t zone_start; /* Zone offset in md_dev (in sectors) */
9 sector_t dev_start; /* Zone offset in real dev (in sectors) */ 9 sector_t dev_start; /* Zone offset in real dev (in sectors) */
10 sector_t size; /* Zone size */ 10 sector_t sectors; /* Zone size in sectors */
11 int nb_dev; /* # of devices attached to the zone */ 11 int nb_dev; /* # of devices attached to the zone */
12 mdk_rdev_t **dev; /* Devices attached to the zone */ 12 mdk_rdev_t **dev; /* Devices attached to the zone */
13}; 13};