Skip to contentSkip to conversation

dm-core: Add zero-size barrier processing to device-mapper

PATCH In review Milan Broz 1 participant 1 message Jan 8, 2009 Device mapper

lore
Share & tools
lore

Milan Broz

author
#0 lore raw

PATCH 2/4 dm-core: Add zero-size barrier processing to device-mapper

Add zero-size barrier processing to device-mapper.

Barrier without payload is now resent to all targets in mapped devices.
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.)

---
 drivers/md/dm-stripe.c |    9 +++
 drivers/md/dm.c        |  158 +++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 153 insertions(+), 14 deletions(-)
drivers/md/dm-stripe.c +9 -0
index 41569bc..b9e6396 100644
@@ -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 +144 -14

267 lines not on this page · raw message