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>
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;
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;
}