Commit 83838ed8 authored by Andre Noll's avatar Andre Noll Committed by NeilBrown

md: raid0: Represent the size of strip zones in sectors.

This completes the block -> sector conversion of struct strip_zone.
Signed-off-by: default avatarAndre Noll <maan@systemlinux.org>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 0825b87a
...@@ -156,11 +156,11 @@ static int create_strip_zones (mddev_t *mddev) ...@@ -156,11 +156,11 @@ static int create_strip_zones (mddev_t *mddev)
goto abort; goto abort;
} }
zone->nb_dev = cnt; zone->nb_dev = cnt;
zone->size = smallest->size * cnt; zone->sectors = smallest->size * cnt * 2;
zone->zone_start = 0; zone->zone_start = 0;
current_start = smallest->size * 2; current_start = smallest->size * 2;
curr_zone_start = zone->size * 2; curr_zone_start = zone->sectors;
/* now do the other zones */ /* now do the other zones */
for (i = 1; i < conf->nr_strip_zones; i++) for (i = 1; i < conf->nr_strip_zones; i++)
...@@ -193,12 +193,12 @@ static int create_strip_zones (mddev_t *mddev) ...@@ -193,12 +193,12 @@ static int create_strip_zones (mddev_t *mddev)
} }
zone->nb_dev = c; zone->nb_dev = c;
zone->size = (smallest->size - current_start / 2) * c; zone->sectors = (smallest->size * 2 - current_start) * c;
printk(KERN_INFO "raid0: zone->nb_dev: %d, size: %llu\n", printk(KERN_INFO "raid0: zone->nb_dev: %d, sectors: %llu\n",
zone->nb_dev, (unsigned long long)zone->size); zone->nb_dev, (unsigned long long)zone->sectors);
zone->zone_start = curr_zone_start; zone->zone_start = curr_zone_start;
curr_zone_start += zone->size * 2; curr_zone_start += zone->sectors;
current_start = smallest->size * 2; current_start = smallest->size * 2;
printk(KERN_INFO "raid0: current zone start: %llu\n", printk(KERN_INFO "raid0: current zone start: %llu\n",
...@@ -220,7 +220,7 @@ static int create_strip_zones (mddev_t *mddev) ...@@ -220,7 +220,7 @@ static int create_strip_zones (mddev_t *mddev)
sector_t sz = 0; sector_t sz = 0;
for (j=i; j<conf->nr_strip_zones-1 && for (j=i; j<conf->nr_strip_zones-1 &&
sz < min_spacing ; j++) sz < min_spacing ; j++)
sz += conf->strip_zone[j].size; sz += conf->strip_zone[j].sectors / 2;
if (sz >= min_spacing && sz < conf->hash_spacing) if (sz >= min_spacing && sz < conf->hash_spacing)
conf->hash_spacing = sz; conf->hash_spacing = sz;
} }
...@@ -325,13 +325,13 @@ static int raid0_run (mddev_t *mddev) ...@@ -325,13 +325,13 @@ static int raid0_run (mddev_t *mddev)
conf->hash_table = kmalloc (sizeof (struct strip_zone *)*nb_zone, GFP_KERNEL); conf->hash_table = kmalloc (sizeof (struct strip_zone *)*nb_zone, GFP_KERNEL);
if (!conf->hash_table) if (!conf->hash_table)
goto out_free_conf; goto out_free_conf;
size = conf->strip_zone[cur].size; size = conf->strip_zone[cur].sectors / 2;
conf->hash_table[0] = conf->strip_zone + cur; conf->hash_table[0] = conf->strip_zone + cur;
for (i=1; i< nb_zone; i++) { for (i=1; i< nb_zone; i++) {
while (size <= conf->hash_spacing) { while (size <= conf->hash_spacing) {
cur++; cur++;
size += conf->strip_zone[cur].size; size += conf->strip_zone[cur].sectors / 2;
} }
size -= conf->hash_spacing; size -= conf->hash_spacing;
conf->hash_table[i] = conf->strip_zone + cur; conf->hash_table[i] = conf->strip_zone + cur;
...@@ -440,7 +440,7 @@ static int raid0_make_request (struct request_queue *q, struct bio *bio) ...@@ -440,7 +440,7 @@ static int raid0_make_request (struct request_queue *q, struct bio *bio)
zone = conf->hash_table[x]; zone = conf->hash_table[x];
} }
while (sector / 2 >= (zone->zone_start / 2 + zone->size)) while (sector >= zone->zone_start + zone->sectors)
zone++; zone++;
sect_in_chunk = bio->bi_sector & (chunk_sects - 1); sect_in_chunk = bio->bi_sector & (chunk_sects - 1);
...@@ -495,7 +495,7 @@ static void raid0_status (struct seq_file *seq, mddev_t *mddev) ...@@ -495,7 +495,7 @@ static void raid0_status (struct seq_file *seq, mddev_t *mddev)
seq_printf(seq, "] zs=%d ds=%d s=%d\n", seq_printf(seq, "] zs=%d ds=%d s=%d\n",
conf->strip_zone[j].zone_start, conf->strip_zone[j].zone_start,
conf->strip_zone[j].dev_start, conf->strip_zone[j].dev_start,
conf->strip_zone[j].size); conf->strip_zone[j].sectors);
} }
#endif #endif
seq_printf(seq, " %dk chunks", mddev->chunk_size/1024); seq_printf(seq, " %dk chunks", mddev->chunk_size/1024);
......
...@@ -7,7 +7,7 @@ struct strip_zone ...@@ -7,7 +7,7 @@ struct strip_zone
{ {
sector_t zone_start; /* Zone offset in md_dev (in sectors) */ sector_t zone_start; /* Zone offset in md_dev (in sectors) */
sector_t dev_start; /* Zone offset in real dev (in sectors) */ sector_t dev_start; /* Zone offset in real dev (in sectors) */
sector_t size; /* Zone size */ sector_t sectors; /* Zone size in sectors */
int nb_dev; /* # of devices attached to the zone */ int nb_dev; /* # of devices attached to the zone */
mdk_rdev_t **dev; /* Devices attached to the zone */ mdk_rdev_t **dev; /* Devices attached to the zone */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment