Commit c97ea25e authored by Kevin Corry's avatar Kevin Corry Committed by Linus Torvalds

[PATCH] device-mapper: fix TB stripe data corruption

In stripe_map(), change chunk to 64-bit and use do_div to divide and mod by
the number of stripes.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d1e14142
......@@ -173,9 +173,8 @@ static int stripe_map(struct dm_target *ti, struct bio *bio,
struct stripe_c *sc = (struct stripe_c *) ti->private;
sector_t offset = bio->bi_sector - ti->begin;
uint32_t chunk = (uint32_t) (offset >> sc->chunk_shift);
uint32_t stripe = chunk % sc->stripes; /* 32bit modulus */
chunk = chunk / sc->stripes;
sector_t chunk = offset >> sc->chunk_shift;
uint32_t stripe = do_div(chunk, sc->stripes);
bio->bi_bdev = sc->stripe[stripe].dev->bdev;
bio->bi_sector = sc->stripe[stripe].physical_start +
......@@ -210,7 +209,7 @@ static int stripe_status(struct dm_target *ti,
static struct target_type stripe_target = {
.name = "striped",
.version= {1, 0, 1},
.version= {1, 0, 2},
.module = THIS_MODULE,
.ctr = stripe_ctr,
.dtr = stripe_dtr,
......
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