diff options
-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 { | |||
26 | struct stripe_c { | 26 | struct 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 | ||