summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-snap.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2009-12-10 23:52:33 +0000
committerAlasdair G Kergon <agk@redhat.com>2009-12-10 23:52:33 +0000
commit17aa03326d40614db94bc51fbbc92df628a5c97c (patch)
treea9661a11274731b6b8e2fcbaace7d4424b9cefb6 /drivers/md/dm-snap.c
parent9fe862548821b0c206c58e8057b782530a173703 (diff)
downloadlinux-17aa03326d40614db94bc51fbbc92df628a5c97c.tar.bz2
dm snapshot: delay merging a chunk until writes to it complete
Track writes to chunks that are currently being merged and delay merging a chunk until all writes to that chunk finish. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Reviewed-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-snap.c')
-rw-r--r--drivers/md/dm-snap.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 91a47c522b09..bc52776c69cc 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -892,7 +892,7 @@ static void snapshot_merge_next_chunks(struct dm_snapshot *s)
s->num_merging_chunks = 1;
up_write(&s->lock);
- /* !!! FIXME: wait until writes to this chunk drain */
+ __check_for_conflicting_io(s, old_chunk);
dm_kcopyd_copy(s->kcopyd_client, &src, 1, &dest, 0, merge_callback, s);
return;
@@ -1635,7 +1635,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;
}