diff options
author | Andre Noll <maan@systemlinux.org> | 2009-01-08 22:31:06 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-01-08 22:31:06 +0100 |
commit | e0f06868341700c5c1964a04f6c5b51d0a2d5bca (patch) | |
tree | 3709a5c7868c721086416737f71b1382a2690be6 /drivers/md | |
parent | md: raid0_make_request(): Remove local variable chunk_size. (diff) | |
download | linux-e0f06868341700c5c1964a04f6c5b51d0a2d5bca.tar.xz linux-e0f06868341700c5c1964a04f6c5b51d0a2d5bca.zip |
md: raid0_make_request(): Replace local variable block by sector.
This change already simplifies the code a bit.
Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to '')
-rw-r--r-- | drivers/md/raid0.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index d8438494e9db..fd65d8806c0f 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -392,7 +392,7 @@ static int raid0_make_request (struct request_queue *q, struct bio *bio) struct strip_zone *zone; mdk_rdev_t *tmp_dev; sector_t chunk; - sector_t block, rsect; + sector_t sector, rsect; const int rw = bio_data_dir(bio); int cpu; @@ -409,8 +409,7 @@ static int raid0_make_request (struct request_queue *q, struct bio *bio) chunk_sects = mddev->chunk_size >> 9; chunksect_bits = ffz(~chunk_sects); - block = bio->bi_sector >> 1; - + sector = bio->bi_sector; if (unlikely(chunk_sects < (bio->bi_sector & (chunk_sects - 1)) + (bio->bi_size >> 9))) { struct bio_pair *bp; @@ -433,24 +432,24 @@ static int raid0_make_request (struct request_queue *q, struct bio *bio) { - sector_t x = block >> conf->preshift; + sector_t x = sector >> (conf->preshift + 1); sector_div(x, (u32)conf->hash_spacing); zone = conf->hash_table[x]; } - while (block >= (zone->zone_offset + zone->size)) + while (sector / 2 >= (zone->zone_offset + zone->size)) zone++; sect_in_chunk = bio->bi_sector & (chunk_sects - 1); { - sector_t x = (block - zone->zone_offset) >> (chunksect_bits - 1); + sector_t x = (sector - zone->zone_offset * 2) >> chunksect_bits; sector_div(x, zone->nb_dev); chunk = x; - x = block >> (chunksect_bits - 1); + x = sector >> chunksect_bits; tmp_dev = zone->dev[sector_div(x, zone->nb_dev)]; } rsect = (((chunk << (chunksect_bits - 1)) + zone->dev_offset)<<1) |