aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-stripe.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2012-07-27 10:08:00 -0400
committerAlasdair G Kergon <agk@redhat.com>2012-07-27 10:08:00 -0400
commit1df05483d758ea43abc375869fbe06be506ba827 (patch)
tree230f9e574467fbe34cb5a96120b9466bbc27d5f8 /drivers/md/dm-stripe.c
parentf14fa693c93078444b5e95d7cad78ead0383ad50 (diff)
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.c9
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 {
26struct stripe_c { 26struct stripe_c {
27 uint32_t stripes; 27 uint32_t stripes;
28 int stripes_shift; 28 int stripes_shift;
29 sector_t stripes_mask;
30 29
31 /* The size of this target / num. stripes */ 30 /* The size of this target / num. stripes */
32 sector_t stripe_width; 31 sector_t stripe_width;
@@ -163,10 +162,8 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
163 162
164 if (stripes & (stripes - 1)) 163 if (stripes & (stripes - 1))
165 sc->stripes_shift = -1; 164 sc->stripes_shift = -1;
166 else { 165 else
167 sc->stripes_shift = ffs(stripes) - 1; 166 sc->stripes_shift = __ffs(stripes);
168 sc->stripes_mask = ((sector_t) stripes) - 1;
169 }
170 167
171 ti->split_io = chunk_size; 168 ti->split_io = chunk_size;
172 ti->num_flush_requests = stripes; 169 ti->num_flush_requests = stripes;
@@ -218,7 +215,7 @@ static void stripe_map_sector(struct stripe_c *sc, sector_t sector,
218 if (sc->stripes_shift < 0) 215 if (sc->stripes_shift < 0)
219 *stripe = sector_div(chunk, sc->stripes); 216 *stripe = sector_div(chunk, sc->stripes);
220 else { 217 else {
221 *stripe = chunk & sc->stripes_mask; 218 *stripe = chunk & (sc->stripes - 1);
222 chunk >>= sc->stripes_shift; 219 chunk >>= sc->stripes_shift;
223 } 220 }
224 221