dm core: add support for empty barriers
RFC PATCH 2/4 dm core: add support for empty barriers
Add zero-size barrier processing to device-mapper.
Barrier without payload is now resent to all targets in mapped devices using internal workqueue per md target. Target is responsible for barrier processing.
After processing all cloned requests is the parent barrier request finished.
Only one barrier in time is processed, all subsequent bio requests are queued (including possible other barrier bios).
Define special processing for stripe target, every device in stripe set must receive empty barrier bio.
All other targets (in kernel) should process barriers without changes correctly now.
(But probably some optimizations needed.)
Signed-off-by Milan Broz <[email protected]>
--- drivers/md/dm-stripe.c | 9 +++ drivers/md/dm.c | 153 +++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 148 insertions(+), 14 deletions(-)
drivers/md/dm-stripe.c +9 -0
@@ -216,6 +216,15 @@ static int stripe_map(struct dm_target *ti, struct bio *bio,sector_t chunk = offset >> sc->chunk_shift;uint32_t stripe =sector_div (chunk, sc->stripes); +if (unlikely (bio_empty_barrier (bio))) { +unsigned int i, r =0 ; + +for (i =0 ; i < sc->stripes && r ==0 ; i++) + r =blkdev_issue_flush (sc->stripe[i].dev->bdev,NULL ); +bio_endio (bio, r); +return DM_MAPIO_SUBMITTED ; + } + bio->bi_bdev = sc->stripe[stripe].dev->bdev; bio->bi_sector = sc->stripe[stripe].physical_start + (chunk << sc->chunk_shift) + (offset & sc->chunk_mask);
drivers/md/dm.c +139 -14
262 lines not on this page · raw message