dm: stripe support flush
Flush support for the stripe target. This sets ti->num_flush_requests to the number of stripes and remaps individual flush requests to the appropriate stripe devices. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
This commit is contained in:
parent
433bcac564
commit
374bf7e7f6
|
@ -167,6 +167,7 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
||||||
sc->stripes = stripes;
|
sc->stripes = stripes;
|
||||||
sc->stripe_width = width;
|
sc->stripe_width = width;
|
||||||
ti->split_io = chunk_size;
|
ti->split_io = chunk_size;
|
||||||
|
ti->num_flush_requests = stripes;
|
||||||
|
|
||||||
sc->chunk_mask = ((sector_t) chunk_size) - 1;
|
sc->chunk_mask = ((sector_t) chunk_size) - 1;
|
||||||
for (sc->chunk_shift = 0; chunk_size; sc->chunk_shift++)
|
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,
|
||||||
union map_info *map_context)
|
union map_info *map_context)
|
||||||
{
|
{
|
||||||
struct stripe_c *sc = (struct stripe_c *) ti->private;
|
struct stripe_c *sc = (struct stripe_c *) ti->private;
|
||||||
|
sector_t offset, chunk;
|
||||||
|
uint32_t stripe;
|
||||||
|
|
||||||
sector_t offset = bio->bi_sector - ti->begin;
|
if (unlikely(bio_empty_barrier(bio))) {
|
||||||
sector_t chunk = offset >> sc->chunk_shift;
|
BUG_ON(map_context->flush_request >= sc->stripes);
|
||||||
uint32_t stripe = sector_div(chunk, sc->stripes);
|
bio->bi_bdev = sc->stripe[map_context->flush_request].dev->bdev;
|
||||||
|
return DM_MAPIO_REMAPPED;
|
||||||
|
}
|
||||||
|
|
||||||
|
offset = bio->bi_sector - ti->begin;
|
||||||
|
chunk = offset >> sc->chunk_shift;
|
||||||
|
stripe = sector_div(chunk, sc->stripes);
|
||||||
|
|
||||||
bio->bi_bdev = sc->stripe[stripe].dev->bdev;
|
bio->bi_bdev = sc->stripe[stripe].dev->bdev;
|
||||||
bio->bi_sector = sc->stripe[stripe].physical_start +
|
bio->bi_sector = sc->stripe[stripe].physical_start +
|
||||||
|
|
Loading…
Reference in New Issue