[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] [PATCH 14/17] bottom-layer barrier support



dm-snapshot-flush.patch

Flush support for dm-snapshot target.

This patch just forwars the flush request to origin and snapshot device,
it doesn't flush exception store metadata.

Signed-off-by: Mikulas Patocka <mpatocka redhat com>

---
 drivers/md/dm-snap.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

Index: linux-2.6.30-rc1-devel/drivers/md/dm-snap.c
===================================================================
--- linux-2.6.30-rc1-devel.orig/drivers/md/dm-snap.c	2009-04-10 06:24:53.000000000 +0200
+++ linux-2.6.30-rc1-devel/drivers/md/dm-snap.c	2009-04-10 06:33:48.000000000 +0200
@@ -678,6 +678,7 @@ static int snapshot_ctr(struct dm_target
 
 	ti->private = s;
 	ti->split_io = s->store->chunk_size;
+	ti->num_flush_requests = 1;
 
 	return 0;
 
@@ -1030,6 +1031,11 @@ static int snapshot_map(struct dm_target
 	chunk_t chunk;
 	struct dm_snap_pending_exception *pe = NULL;
 
+	if (unlikely(bio_empty_barrier(bio))) {
+		bio->bi_bdev = s->store->cow->bdev;
+		return DM_MAPIO_REMAPPED;
+	}
+
 	chunk = sector_to_chunk(s->store, bio->bi_sector);
 
 	/* Full snapshots are not usable */
@@ -1338,6 +1344,8 @@ static int origin_ctr(struct dm_target *
 	}
 
 	ti->private = dev;
+	ti->num_flush_requests = 1;
+
 	return 0;
 }
 
@@ -1353,6 +1361,9 @@ static int origin_map(struct dm_target *
 	struct dm_dev *dev = ti->private;
 	bio->bi_bdev = dev->bdev;
 
+	if (unlikely(bio_empty_barrier(bio)))
+		return DM_MAPIO_REMAPPED;
+
 	/* Only tell snapshots if this is a write */
 	return (bio_rw(bio) == WRITE) ? do_origin(dev, bio) : DM_MAPIO_REMAPPED;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]