Skip to content

Commit 83838ed

Browse files
Andre Nollneilbrown
authored andcommitted
md: raid0: Represent the size of strip zones in sectors.
This completes the block -> sector conversion of struct strip_zone. Signed-off-by: Andre Noll <maan@systemlinux.org> Signed-off-by: NeilBrown <neilb@suse.de>
1 parent 0825b87 commit 83838ed

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

drivers/md/raid0.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ static int create_strip_zones (mddev_t *mddev)
156156
goto abort;
157157
}
158158
zone->nb_dev = cnt;
159-
zone->size = smallest->size * cnt;
159+
zone->sectors = smallest->size * cnt * 2;
160160
zone->zone_start = 0;
161161

162162
current_start = smallest->size * 2;
163-
curr_zone_start = zone->size * 2;
163+
curr_zone_start = zone->sectors;
164164

165165
/* now do the other zones */
166166
for (i = 1; i < conf->nr_strip_zones; i++)
@@ -193,12 +193,12 @@ static int create_strip_zones (mddev_t *mddev)
193193
}
194194

195195
zone->nb_dev = c;
196-
zone->size = (smallest->size - current_start / 2) * c;
197-
printk(KERN_INFO "raid0: zone->nb_dev: %d, size: %llu\n",
198-
zone->nb_dev, (unsigned long long)zone->size);
196+
zone->sectors = (smallest->size * 2 - current_start) * c;
197+
printk(KERN_INFO "raid0: zone->nb_dev: %d, sectors: %llu\n",
198+
zone->nb_dev, (unsigned long long)zone->sectors);
199199

200200
zone->zone_start = curr_zone_start;
201-
curr_zone_start += zone->size * 2;
201+
curr_zone_start += zone->sectors;
202202

203203
current_start = smallest->size * 2;
204204
printk(KERN_INFO "raid0: current zone start: %llu\n",
@@ -220,7 +220,7 @@ static int create_strip_zones (mddev_t *mddev)
220220
sector_t sz = 0;
221221
for (j=i; j<conf->nr_strip_zones-1 &&
222222
sz < min_spacing ; j++)
223-
sz += conf->strip_zone[j].size;
223+
sz += conf->strip_zone[j].sectors / 2;
224224
if (sz >= min_spacing && sz < conf->hash_spacing)
225225
conf->hash_spacing = sz;
226226
}
@@ -325,13 +325,13 @@ static int raid0_run (mddev_t *mddev)
325325
conf->hash_table = kmalloc (sizeof (struct strip_zone *)*nb_zone, GFP_KERNEL);
326326
if (!conf->hash_table)
327327
goto out_free_conf;
328-
size = conf->strip_zone[cur].size;
328+
size = conf->strip_zone[cur].sectors / 2;
329329

330330
conf->hash_table[0] = conf->strip_zone + cur;
331331
for (i=1; i< nb_zone; i++) {
332332
while (size <= conf->hash_spacing) {
333333
cur++;
334-
size += conf->strip_zone[cur].size;
334+
size += conf->strip_zone[cur].sectors / 2;
335335
}
336336
size -= conf->hash_spacing;
337337
conf->hash_table[i] = conf->strip_zone + cur;
@@ -439,10 +439,10 @@ static int raid0_make_request (struct request_queue *q, struct bio *bio)
439439
sector_div(x, (u32)conf->hash_spacing);
440440
zone = conf->hash_table[x];
441441
}
442-
443-
while (sector / 2 >= (zone->zone_start / 2 + zone->size))
442+
443+
while (sector >= zone->zone_start + zone->sectors)
444444
zone++;
445-
445+
446446
sect_in_chunk = bio->bi_sector & (chunk_sects - 1);
447447

448448

@@ -495,7 +495,7 @@ static void raid0_status (struct seq_file *seq, mddev_t *mddev)
495495
seq_printf(seq, "] zs=%d ds=%d s=%d\n",
496496
conf->strip_zone[j].zone_start,
497497
conf->strip_zone[j].dev_start,
498-
conf->strip_zone[j].size);
498+
conf->strip_zone[j].sectors);
499499
}
500500
#endif
501501
seq_printf(seq, " %dk chunks", mddev->chunk_size/1024);

include/linux/raid/raid0.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ struct strip_zone
77
{
88
sector_t zone_start; /* Zone offset in md_dev (in sectors) */
99
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 */
1111
int nb_dev; /* # of devices attached to the zone */
1212
mdk_rdev_t **dev; /* Devices attached to the zone */
1313
};

0 commit comments

Comments
 (0)