Commit 6b8796cc authored by Andre Noll's avatar Andre Noll Committed by NeilBrown

md: raid0 create_strip_zones(): Make two local variables sector-based.

current_offset and curr_zone_offset stored the corresponding offsets
as 1K quantities. Rename them to current_start and curr_zone_start
to match the naming of struct strip_zone and store the offsets as
sector counts.

Also, add KERN_INFO to the printk() affected by this change to make
checkpatch happy.
Signed-off-by: default avatarAndre Noll <maan@systemlinux.org>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 6199d3db
...@@ -53,7 +53,7 @@ static int raid0_congested(void *data, int bits) ...@@ -53,7 +53,7 @@ static int raid0_congested(void *data, int bits)
static int create_strip_zones (mddev_t *mddev) static int create_strip_zones (mddev_t *mddev)
{ {
int i, c, j; int i, c, j;
sector_t current_offset, curr_zone_offset; sector_t current_start, curr_zone_start;
sector_t min_spacing; sector_t min_spacing;
raid0_conf_t *conf = mddev_to_conf(mddev); raid0_conf_t *conf = mddev_to_conf(mddev);
mdk_rdev_t *smallest, *rdev1, *rdev2, *rdev; mdk_rdev_t *smallest, *rdev1, *rdev2, *rdev;
...@@ -157,8 +157,8 @@ static int create_strip_zones (mddev_t *mddev) ...@@ -157,8 +157,8 @@ static int create_strip_zones (mddev_t *mddev)
zone->size = smallest->size * cnt; zone->size = smallest->size * cnt;
zone->zone_start = 0; zone->zone_start = 0;
current_offset = smallest->size; current_start = smallest->size * 2;
curr_zone_offset = zone->size; curr_zone_start = zone->size * 2;
/* 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++)
...@@ -167,7 +167,7 @@ static int create_strip_zones (mddev_t *mddev) ...@@ -167,7 +167,7 @@ static int create_strip_zones (mddev_t *mddev)
zone->dev = conf->strip_zone[i-1].dev + mddev->raid_disks; zone->dev = conf->strip_zone[i-1].dev + mddev->raid_disks;
printk("raid0: zone %d\n", i); printk("raid0: zone %d\n", i);
zone->dev_start = current_offset * 2; zone->dev_start = current_start;
smallest = NULL; smallest = NULL;
c = 0; c = 0;
...@@ -175,8 +175,7 @@ static int create_strip_zones (mddev_t *mddev) ...@@ -175,8 +175,7 @@ static int create_strip_zones (mddev_t *mddev)
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
rdev = conf->strip_zone[0].dev[j]; rdev = conf->strip_zone[0].dev[j];
printk("raid0: checking %s ...", bdevname(rdev->bdev,b)); printk("raid0: checking %s ...", bdevname(rdev->bdev,b));
if (rdev->size > current_offset) if (rdev->size > current_start / 2) {
{
printk(" contained as device %d\n", c); printk(" contained as device %d\n", c);
zone->dev[c] = rdev; zone->dev[c] = rdev;
c++; c++;
...@@ -190,16 +189,16 @@ static int create_strip_zones (mddev_t *mddev) ...@@ -190,16 +189,16 @@ static int create_strip_zones (mddev_t *mddev)
} }
zone->nb_dev = c; zone->nb_dev = c;
zone->size = (smallest->size - current_offset) * c; zone->size = (smallest->size - current_start / 2) * c;
printk("raid0: zone->nb_dev: %d, size: %llu\n", printk("raid0: zone->nb_dev: %d, size: %llu\n",
zone->nb_dev, (unsigned long long)zone->size); zone->nb_dev, (unsigned long long)zone->size);
zone->zone_start = curr_zone_offset * 2; zone->zone_start = curr_zone_start;
curr_zone_offset += zone->size; curr_zone_start += zone->size * 2;
current_offset = smallest->size; current_start = smallest->size * 2;
printk("raid0: current zone offset: %llu\n", printk(KERN_INFO "raid0: current zone start: %llu\n",
(unsigned long long)current_offset); (unsigned long long)current_start);
} }
/* Now find appropriate hash spacing. /* Now find appropriate hash spacing.
...@@ -210,8 +209,8 @@ static int create_strip_zones (mddev_t *mddev) ...@@ -210,8 +209,8 @@ static int create_strip_zones (mddev_t *mddev)
* strip though as it's size has no bearing on the efficacy of the hash * strip though as it's size has no bearing on the efficacy of the hash
* table. * table.
*/ */
conf->hash_spacing = curr_zone_offset; conf->hash_spacing = curr_zone_start / 2;
min_spacing = curr_zone_offset; min_spacing = curr_zone_start / 2;
sector_div(min_spacing, PAGE_SIZE/sizeof(struct strip_zone*)); sector_div(min_spacing, PAGE_SIZE/sizeof(struct strip_zone*));
for (i=0; i < conf->nr_strip_zones-1; i++) { for (i=0; i < conf->nr_strip_zones-1; i++) {
sector_t sz = 0; sector_t sz = 0;
......
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