diff options
| -rw-r--r-- | drivers/md/dm-stripe.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index 41569bc60abc..c64fe827a5f1 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c | |||
| @@ -167,6 +167,7 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
| 167 | sc->stripes = stripes; | 167 | sc->stripes = stripes; |
| 168 | sc->stripe_width = width; | 168 | sc->stripe_width = width; |
| 169 | ti->split_io = chunk_size; | 169 | ti->split_io = chunk_size; |
| 170 | ti->num_flush_requests = stripes; | ||
| 170 | 171 | ||
| 171 | sc->chunk_mask = ((sector_t) chunk_size) - 1; | 172 | sc->chunk_mask = ((sector_t) chunk_size) - 1; |
| 172 | for (sc->chunk_shift = 0; chunk_size; sc->chunk_shift++) | 173 | for (sc->chunk_shift = 0; chunk_size; sc->chunk_shift++) |
| @@ -211,10 +212,18 @@ static int stripe_map(struct dm_target *ti, struct bio *bio, | |||
| 211 | union map_info *map_context) | 212 | union map_info *map_context) |
| 212 | { | 213 | { |
| 213 | struct stripe_c *sc = (struct stripe_c *) ti->private; | 214 | struct stripe_c *sc = (struct stripe_c *) ti->private; |
| 215 | sector_t offset, chunk; | ||
| 216 | uint32_t stripe; | ||
| 214 | 217 | ||
| 215 | sector_t offset = bio->bi_sector - ti->begin; | 218 | if (unlikely(bio_empty_barrier(bio))) { |
| 216 | sector_t chunk = offset >> sc->chunk_shift; | 219 | BUG_ON(map_context->flush_request >= sc->stripes); |
| 217 | uint32_t stripe = sector_div(chunk, sc->stripes); | 220 | bio->bi_bdev = sc->stripe[map_context->flush_request].dev->bdev; |
| 221 | return DM_MAPIO_REMAPPED; | ||
| 222 | } | ||
| 223 | |||
| 224 | offset = bio->bi_sector - ti->begin; | ||
| 225 | chunk = offset >> sc->chunk_shift; | ||
| 226 | stripe = sector_div(chunk, sc->stripes); | ||
| 218 | 227 | ||
| 219 | bio->bi_bdev = sc->stripe[stripe].dev->bdev; | 228 | bio->bi_bdev = sc->stripe[stripe].dev->bdev; |
| 220 | bio->bi_sector = sc->stripe[stripe].physical_start + | 229 | bio->bi_sector = sc->stripe[stripe].physical_start + |
