diff options
author | NeilBrown <neilb@suse.de> | 2009-06-16 02:46:46 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-06-16 02:46:46 -0400 |
commit | d27a43abd7be0ab4b2337e4587feca8c7340e5f9 (patch) | |
tree | a5a3e0ec947ebfc0d3dc75b9487c8e80de176a2d /drivers/md/raid0.c | |
parent | dc58266385e51420298275c90a616c34f1473a73 (diff) |
md/raid0: two cleanups in create_stripe_zones.
1/ remove current_start. The same value is available in
zone->dev_start and storing it separately doesn't gain anything.
2/ rename curr_zone_start to curr_zone_end as we are now more
focused on the 'end' of each zone. We end up storing the
same number though - the old name was a little confusing
(and what does 'current' mean in this context anyway).
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid0.c')
-rw-r--r-- | drivers/md/raid0.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index bb245a6d16c8..1afdfd120bba 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -55,7 +55,7 @@ static int raid0_congested(void *data, int bits) | |||
55 | static int create_strip_zones (mddev_t *mddev) | 55 | static int create_strip_zones (mddev_t *mddev) |
56 | { | 56 | { |
57 | int i, c, j; | 57 | int i, c, j; |
58 | sector_t current_start, curr_zone_start; | 58 | sector_t curr_zone_end; |
59 | sector_t min_spacing; | 59 | sector_t min_spacing; |
60 | raid0_conf_t *conf = mddev_to_conf(mddev); | 60 | raid0_conf_t *conf = mddev_to_conf(mddev); |
61 | mdk_rdev_t *smallest, *rdev1, *rdev2, *rdev; | 61 | mdk_rdev_t *smallest, *rdev1, *rdev2, *rdev; |
@@ -159,8 +159,7 @@ static int create_strip_zones (mddev_t *mddev) | |||
159 | zone->sectors = smallest->sectors * cnt; | 159 | zone->sectors = smallest->sectors * cnt; |
160 | zone->zone_end = zone->sectors; | 160 | zone->zone_end = zone->sectors; |
161 | 161 | ||
162 | current_start = smallest->sectors; | 162 | curr_zone_end = zone->sectors; |
163 | curr_zone_start = zone->sectors; | ||
164 | 163 | ||
165 | /* now do the other zones */ | 164 | /* now do the other zones */ |
166 | for (i = 1; i < conf->nr_strip_zones; i++) | 165 | for (i = 1; i < conf->nr_strip_zones; i++) |
@@ -169,7 +168,7 @@ static int create_strip_zones (mddev_t *mddev) | |||
169 | zone->dev = conf->strip_zone[i-1].dev + mddev->raid_disks; | 168 | zone->dev = conf->strip_zone[i-1].dev + mddev->raid_disks; |
170 | 169 | ||
171 | printk(KERN_INFO "raid0: zone %d\n", i); | 170 | printk(KERN_INFO "raid0: zone %d\n", i); |
172 | zone->dev_start = current_start; | 171 | zone->dev_start = smallest->sectors; |
173 | smallest = NULL; | 172 | smallest = NULL; |
174 | c = 0; | 173 | c = 0; |
175 | 174 | ||
@@ -178,7 +177,7 @@ static int create_strip_zones (mddev_t *mddev) | |||
178 | rdev = conf->strip_zone[0].dev[j]; | 177 | rdev = conf->strip_zone[0].dev[j]; |
179 | printk(KERN_INFO "raid0: checking %s ...", | 178 | printk(KERN_INFO "raid0: checking %s ...", |
180 | bdevname(rdev->bdev, b)); | 179 | bdevname(rdev->bdev, b)); |
181 | if (rdev->sectors <= current_start) { | 180 | if (rdev->sectors <= zone->dev_start) { |
182 | printk(KERN_INFO " nope.\n"); | 181 | printk(KERN_INFO " nope.\n"); |
183 | continue; | 182 | continue; |
184 | } | 183 | } |
@@ -193,16 +192,15 @@ static int create_strip_zones (mddev_t *mddev) | |||
193 | } | 192 | } |
194 | 193 | ||
195 | zone->nb_dev = c; | 194 | zone->nb_dev = c; |
196 | zone->sectors = (smallest->sectors - current_start) * c; | 195 | zone->sectors = (smallest->sectors - zone->dev_start) * c; |
197 | printk(KERN_INFO "raid0: zone->nb_dev: %d, sectors: %llu\n", | 196 | printk(KERN_INFO "raid0: zone->nb_dev: %d, sectors: %llu\n", |
198 | zone->nb_dev, (unsigned long long)zone->sectors); | 197 | zone->nb_dev, (unsigned long long)zone->sectors); |
199 | 198 | ||
200 | zone->zone_end = curr_zone_start + zone->sectors; | 199 | curr_zone_end += zone->sectors; |
201 | curr_zone_start += zone->sectors; | 200 | zone->zone_end = curr_zone_end; |
202 | 201 | ||
203 | current_start = smallest->sectors; | ||
204 | printk(KERN_INFO "raid0: current zone start: %llu\n", | 202 | printk(KERN_INFO "raid0: current zone start: %llu\n", |
205 | (unsigned long long)current_start); | 203 | (unsigned long long)smallest->sectors); |
206 | } | 204 | } |
207 | /* Now find appropriate hash spacing. | 205 | /* Now find appropriate hash spacing. |
208 | * We want a number which causes most hash entries to cover | 206 | * We want a number which causes most hash entries to cover |
@@ -212,8 +210,8 @@ static int create_strip_zones (mddev_t *mddev) | |||
212 | * strip though as it's size has no bearing on the efficacy of the hash | 210 | * strip though as it's size has no bearing on the efficacy of the hash |
213 | * table. | 211 | * table. |
214 | */ | 212 | */ |
215 | conf->spacing = curr_zone_start; | 213 | conf->spacing = curr_zone_end; |
216 | min_spacing = curr_zone_start; | 214 | min_spacing = curr_zone_end; |
217 | sector_div(min_spacing, PAGE_SIZE/sizeof(struct strip_zone*)); | 215 | sector_div(min_spacing, PAGE_SIZE/sizeof(struct strip_zone*)); |
218 | for (i=0; i < conf->nr_strip_zones-1; i++) { | 216 | for (i=0; i < conf->nr_strip_zones-1; i++) { |
219 | sector_t s = 0; | 217 | sector_t s = 0; |