aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/raid0.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 6e12a358f366..9074ea43d523 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -53,7 +53,7 @@ static int raid0_congested(void *data, int bits)
53static int create_strip_zones (mddev_t *mddev) 53static int create_strip_zones (mddev_t *mddev)
54{ 54{
55 int i, c, j; 55 int i, c, j;
56 sector_t current_offset, curr_zone_offset; 56 sector_t current_start, curr_zone_start;
57 sector_t min_spacing; 57 sector_t min_spacing;
58 raid0_conf_t *conf = mddev_to_conf(mddev); 58 raid0_conf_t *conf = mddev_to_conf(mddev);
59 mdk_rdev_t *smallest, *rdev1, *rdev2, *rdev; 59 mdk_rdev_t *smallest, *rdev1, *rdev2, *rdev;
@@ -157,8 +157,8 @@ static int create_strip_zones (mddev_t *mddev)
157 zone->size = smallest->size * cnt; 157 zone->size = smallest->size * cnt;
158 zone->zone_start = 0; 158 zone->zone_start = 0;
159 159
160 current_offset = smallest->size; 160 current_start = smallest->size * 2;
161 curr_zone_offset = zone->size; 161 curr_zone_start = zone->size * 2;
162 162
163 /* now do the other zones */ 163 /* now do the other zones */
164 for (i = 1; i < conf->nr_strip_zones; i++) 164 for (i = 1; i < conf->nr_strip_zones; i++)
@@ -167,7 +167,7 @@ static int create_strip_zones (mddev_t *mddev)
167 zone->dev = conf->strip_zone[i-1].dev + mddev->raid_disks; 167 zone->dev = conf->strip_zone[i-1].dev + mddev->raid_disks;
168 168
169 printk("raid0: zone %d\n", i); 169 printk("raid0: zone %d\n", i);
170 zone->dev_start = current_offset * 2; 170 zone->dev_start = current_start;
171 smallest = NULL; 171 smallest = NULL;
172 c = 0; 172 c = 0;
173 173
@@ -175,8 +175,7 @@ static int create_strip_zones (mddev_t *mddev)
175 char b[BDEVNAME_SIZE]; 175 char b[BDEVNAME_SIZE];
176 rdev = conf->strip_zone[0].dev[j]; 176 rdev = conf->strip_zone[0].dev[j];
177 printk("raid0: checking %s ...", bdevname(rdev->bdev,b)); 177 printk("raid0: checking %s ...", bdevname(rdev->bdev,b));
178 if (rdev->size > current_offset) 178 if (rdev->size > current_start / 2) {
179 {
180 printk(" contained as device %d\n", c); 179 printk(" contained as device %d\n", c);
181 zone->dev[c] = rdev; 180 zone->dev[c] = rdev;
182 c++; 181 c++;
@@ -190,16 +189,16 @@ static int create_strip_zones (mddev_t *mddev)
190 } 189 }
191 190
192 zone->nb_dev = c; 191 zone->nb_dev = c;
193 zone->size = (smallest->size - current_offset) * c; 192 zone->size = (smallest->size - current_start / 2) * c;
194 printk("raid0: zone->nb_dev: %d, size: %llu\n", 193 printk("raid0: zone->nb_dev: %d, size: %llu\n",
195 zone->nb_dev, (unsigned long long)zone->size); 194 zone->nb_dev, (unsigned long long)zone->size);
196 195
197 zone->zone_start = curr_zone_offset * 2; 196 zone->zone_start = curr_zone_start;
198 curr_zone_offset += zone->size; 197 curr_zone_start += zone->size * 2;
199 198
200 current_offset = smallest->size; 199 current_start = smallest->size * 2;
201 printk("raid0: current zone offset: %llu\n", 200 printk(KERN_INFO "raid0: current zone start: %llu\n",
202 (unsigned long long)current_offset); 201 (unsigned long long)current_start);
203 } 202 }
204 203
205 /* Now find appropriate hash spacing. 204 /* Now find appropriate hash spacing.
@@ -210,8 +209,8 @@ static int create_strip_zones (mddev_t *mddev)
210 * strip though as it's size has no bearing on the efficacy of the hash 209 * strip though as it's size has no bearing on the efficacy of the hash
211 * table. 210 * table.
212 */ 211 */
213 conf->hash_spacing = curr_zone_offset; 212 conf->hash_spacing = curr_zone_start / 2;
214 min_spacing = curr_zone_offset; 213 min_spacing = curr_zone_start / 2;
215 sector_div(min_spacing, PAGE_SIZE/sizeof(struct strip_zone*)); 214 sector_div(min_spacing, PAGE_SIZE/sizeof(struct strip_zone*));
216 for (i=0; i < conf->nr_strip_zones-1; i++) { 215 for (i=0; i < conf->nr_strip_zones-1; i++) {
217 sector_t sz = 0; 216 sector_t sz = 0;