From: Andre Noll <maan@systemlinux.org>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, Andre Noll <maan@systemlinux.org>
Subject: [PATCH 2/8] md: raid0_make_request(): Replace local variable block by sector.
Date: Sat, 18 Oct 2008 17:24:23 +0200 [thread overview]
Message-ID: <1224343469-2831-3-git-send-email-maan@systemlinux.org> (raw)
In-Reply-To: <1224343469-2831-1-git-send-email-maan@systemlinux.org>
This change already simplifies the code a bit.
Signed-off-by: Andre Noll <maan@systemlinux.org>
---
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 d843849..fd65d88 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)
--
1.5.3.8
next prev parent reply other threads:[~2008-10-18 15:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-18 15:24 [PATCH 0/8] md: Make raid0 use sector-based quantities Andre Noll
2008-10-18 15:24 ` [PATCH 1/8] md: raid0_make_request(): Remove local variable chunk_size Andre Noll
2008-10-18 15:24 ` Andre Noll [this message]
2008-10-18 15:24 ` [PATCH 3/8] md: raid0: Represent device offset in sectors Andre Noll
2008-10-18 15:24 ` [PATCH 4/8] md: raid0: Represent zone->zone_offset " Andre Noll
2008-10-18 15:24 ` [PATCH 5/8] md: raid0 create_strip_zones(): Make two local variables sector-based Andre Noll
2008-10-18 15:24 ` [PATCH 6/8] md: raid0 create_strip_zones(): Add KERN_INFO/KERN_ERR to printk's Andre Noll
2008-10-18 15:24 ` [PATCH 7/8] md: raid0: Represent the size of strip zones in sectors Andre Noll
2008-10-18 15:24 ` [PATCH 8/8] md: raid0: make hash_spacing and preshift sector-based Andre Noll
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1224343469-2831-3-git-send-email-maan@systemlinux.org \
--to=maan@systemlinux.org \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).