diff options
author | Andre Noll <maan@systemlinux.org> | 2009-01-08 16:31:06 -0500 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-01-08 16:31:06 -0500 |
commit | e0f06868341700c5c1964a04f6c5b51d0a2d5bca (patch) | |
tree | 3709a5c7868c721086416737f71b1382a2690be6 /drivers/md/raid0.c | |
parent | a471200595b24fb1907ad12107a6a66db02c63f2 (diff) |
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 'drivers/md/raid0.c')
-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) | |||
392 | struct strip_zone *zone; | 392 | struct strip_zone *zone; |
393 | mdk_rdev_t *tmp_dev; | 393 | mdk_rdev_t *tmp_dev; |
394 | sector_t chunk; | 394 | sector_t chunk; |
395 | sector_t block, rsect; | 395 | sector_t sector, rsect; |
396 | const int rw = bio_data_dir(bio); | 396 | const int rw = bio_data_dir(bio); |
397 | int cpu; | 397 | int cpu; |
398 | 398 | ||
@@ -409,8 +409,7 @@ static int raid0_make_request (struct request_queue *q, struct bio *bio) | |||
409 | 409 | ||
410 | chunk_sects = mddev->chunk_size >> 9; | 410 | chunk_sects = mddev->chunk_size >> 9; |
411 | chunksect_bits = ffz(~chunk_sects); | 411 | chunksect_bits = ffz(~chunk_sects); |
412 | block = bio->bi_sector >> 1; | 412 | sector = bio->bi_sector; |
413 | |||
414 | 413 | ||
415 | if (unlikely(chunk_sects < (bio->bi_sector & (chunk_sects - 1)) + (bio->bi_size >> 9))) { | 414 | if (unlikely(chunk_sects < (bio->bi_sector & (chunk_sects - 1)) + (bio->bi_size >> 9))) { |
416 | struct bio_pair *bp; | 415 | struct bio_pair *bp; |
@@ -433,24 +432,24 @@ static int raid0_make_request (struct request_queue *q, struct bio *bio) | |||
433 | 432 | ||
434 | 433 | ||
435 | { | 434 | { |
436 | sector_t x = block >> conf->preshift; | 435 | sector_t x = sector >> (conf->preshift + 1); |
437 | sector_div(x, (u32)conf->hash_spacing); | 436 | sector_div(x, (u32)conf->hash_spacing); |
438 | zone = conf->hash_table[x]; | 437 | zone = conf->hash_table[x]; |
439 | } | 438 | } |
440 | 439 | ||
441 | while (block >= (zone->zone_offset + zone->size)) | 440 | while (sector / 2 >= (zone->zone_offset + zone->size)) |
442 | zone++; | 441 | zone++; |
443 | 442 | ||
444 | sect_in_chunk = bio->bi_sector & (chunk_sects - 1); | 443 | sect_in_chunk = bio->bi_sector & (chunk_sects - 1); |
445 | 444 | ||
446 | 445 | ||
447 | { | 446 | { |
448 | sector_t x = (block - zone->zone_offset) >> (chunksect_bits - 1); | 447 | sector_t x = (sector - zone->zone_offset * 2) >> chunksect_bits; |
449 | 448 | ||
450 | sector_div(x, zone->nb_dev); | 449 | sector_div(x, zone->nb_dev); |
451 | chunk = x; | 450 | chunk = x; |
452 | 451 | ||
453 | x = block >> (chunksect_bits - 1); | 452 | x = sector >> chunksect_bits; |
454 | tmp_dev = zone->dev[sector_div(x, zone->nb_dev)]; | 453 | tmp_dev = zone->dev[sector_div(x, zone->nb_dev)]; |
455 | } | 454 | } |
456 | rsect = (((chunk << (chunksect_bits - 1)) + zone->dev_offset)<<1) | 455 | rsect = (((chunk << (chunksect_bits - 1)) + zone->dev_offset)<<1) |