Commit 1df05483 authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Alasdair G Kergon

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: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent f14fa693
...@@ -26,7 +26,6 @@ struct stripe { ...@@ -26,7 +26,6 @@ struct stripe {
struct stripe_c { struct stripe_c {
uint32_t stripes; uint32_t stripes;
int stripes_shift; int stripes_shift;
sector_t stripes_mask;
/* The size of this target / num. stripes */ /* The size of this target / num. stripes */
sector_t stripe_width; sector_t stripe_width;
...@@ -163,10 +162,8 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) ...@@ -163,10 +162,8 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
if (stripes & (stripes - 1)) if (stripes & (stripes - 1))
sc->stripes_shift = -1; sc->stripes_shift = -1;
else { else
sc->stripes_shift = ffs(stripes) - 1; sc->stripes_shift = __ffs(stripes);
sc->stripes_mask = ((sector_t) stripes) - 1;
}
ti->split_io = chunk_size; ti->split_io = chunk_size;
ti->num_flush_requests = stripes; ti->num_flush_requests = stripes;
...@@ -218,7 +215,7 @@ static void stripe_map_sector(struct stripe_c *sc, sector_t sector, ...@@ -218,7 +215,7 @@ static void stripe_map_sector(struct stripe_c *sc, sector_t sector,
if (sc->stripes_shift < 0) if (sc->stripes_shift < 0)
*stripe = sector_div(chunk, sc->stripes); *stripe = sector_div(chunk, sc->stripes);
else { else {
*stripe = chunk & sc->stripes_mask; *stripe = chunk & (sc->stripes - 1);
chunk >>= sc->stripes_shift; chunk >>= sc->stripes_shift;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment