[dm-devel] [PATCH 08/12] dm-snapshot-merge-track-writes
Mike Snitzer
snitzer at redhat.com
Mon Oct 5 19:02:43 UTC 2009
From: Mikulas Patocka <mpatocka at redhat.com>
Track in-progress writes on the merging snapshot device and delay merging
the chunk until all writes to that chunk finish.
Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>
Reviewed-by: Mike Snitzer <snitzer at redhat.com>
---
drivers/md/dm-snap.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 91c80b7..6a55d75 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -700,7 +700,8 @@ static void snapshot_merge_process(struct dm_snapshot *s)
s->merge_write_interlock_n = 1;
up_write(&s->lock);
- /* !!! FIXME: wait until writes to this chunk drain */
+ while (__chunk_is_tracked(s, old_chunk))
+ msleep(1);
dm_kcopyd_copy(s->kcopyd_client, &src, 1, &dest, 0, merge_callback, s);
return;
@@ -1446,7 +1447,11 @@ static int snapshot_merge_map(struct dm_target *ti, struct bio *bio,
r = DM_MAPIO_SUBMITTED;
goto out_unlock;
}
+
remap_exception(s, e, bio, chunk);
+
+ if (bio_rw(bio) == WRITE)
+ map_context->ptr = track_chunk(s, chunk);
goto out_unlock;
}
--
1.6.2.5
More information about the dm-devel
mailing list