diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2012-07-27 18:08:00 +0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2012-07-27 18:08:00 +0400 |
commit | 1df05483d758ea43abc375869fbe06be506ba827 (patch) | |
tree | 230f9e574467fbe34cb5a96120b9466bbc27d5f8 /drivers/md/dm-stripe.c | |
parent | f14fa693c93078444b5e95d7cad78ead0383ad50 (diff) | |
download | linux-1df05483d758ea43abc375869fbe06be506ba827.tar.xz |
dm stripe: remove stripes_mask
The structure stripe_c contains a stripes_mask field. This field is
useless because it can be trivially calculated by subtracting one from
stripes. It is used only at one place. This patch removes it.
The patch also changes ffs(stripes) - 1 to __ffs(stripes).
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-stripe.c')
-rw-r--r-- | drivers/md/dm-stripe.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index 1f6316ed2b31..6931bd18b615 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c @@ -26,7 +26,6 @@ struct stripe { struct stripe_c { uint32_t stripes; int stripes_shift; - sector_t stripes_mask; /* The size of this target / num. stripes */ sector_t stripe_width; @@ -163,10 +162,8 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) if (stripes & (stripes - 1)) sc->stripes_shift = -1; - else { - sc->stripes_shift = ffs(stripes) - 1; - sc->stripes_mask = ((sector_t) stripes) - 1; - } + else + sc->stripes_shift = __ffs(stripes); ti->split_io = chunk_size; ti->num_flush_requests = stripes; @@ -218,7 +215,7 @@ static void stripe_map_sector(struct stripe_c *sc, sector_t sector, if (sc->stripes_shift < 0) *stripe = sector_div(chunk, sc->stripes); else { - *stripe = chunk & sc->stripes_mask; + *stripe = chunk & (sc->stripes - 1); chunk >>= sc->stripes_shift; } |