aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/dm-kcopyd.h
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2011-08-02 07:32:04 -0400
committerAlasdair G Kergon <agk@redhat.com>2011-08-02 07:32:04 -0400
commita6e50b409d3f9e0833e69c3c9cca822e8fa4adbb (patch)
tree82ca807c21156437270e6a1ed255b18ccf8b3672 /include/linux/dm-kcopyd.h
parentd5b9dd04bd74b774b8e8d93ced7a0d15ad403fa9 (diff)
dm snapshot: skip reading origin when overwriting complete chunk
If we write a full chunk in the snapshot, skip reading the origin device because the whole chunk will be overwritten anyway. This patch changes the snapshot write logic when a full chunk is written. In this case: 1. allocate the exception 2. dispatch the bio (but don't report the bio completion to device mapper) 3. write the exception record 4. report bio completed Callbacks must be done through the kcopyd thread, because callbacks must not race with each other. So we create two new functions: dm_kcopyd_prepare_callback: allocate a job structure and prepare the callback. (This function must not be called from interrupt context.) dm_kcopyd_do_callback: submit callback. (This function may be called from interrupt context.) Performance test (on snapshots with 4k chunk size): without the patch: non-direct-io sequential write (dd): 17.7MB/s direct-io sequential write (dd): 20.9MB/s non-direct-io random write (mkfs.ext2): 0.44s with the patch: non-direct-io sequential write (dd): 26.5MB/s direct-io sequential write (dd): 33.2MB/s non-direct-io random write (mkfs.ext2): 0.27s Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'include/linux/dm-kcopyd.h')
-rw-r--r--include/linux/dm-kcopyd.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/dm-kcopyd.h b/include/linux/dm-kcopyd.h
index 298d587e349b..5e54458e920f 100644
--- a/include/linux/dm-kcopyd.h
+++ b/include/linux/dm-kcopyd.h
@@ -42,5 +42,20 @@ int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
42 unsigned num_dests, struct dm_io_region *dests, 42 unsigned num_dests, struct dm_io_region *dests,
43 unsigned flags, dm_kcopyd_notify_fn fn, void *context); 43 unsigned flags, dm_kcopyd_notify_fn fn, void *context);
44 44
45/*
46 * Prepare a callback and submit it via the kcopyd thread.
47 *
48 * dm_kcopyd_prepare_callback allocates a callback structure and returns it.
49 * It must not be called from interrupt context.
50 * The returned value should be passed into dm_kcopyd_do_callback.
51 *
52 * dm_kcopyd_do_callback submits the callback.
53 * It may be called from interrupt context.
54 * The callback is issued from the kcopyd thread.
55 */
56void *dm_kcopyd_prepare_callback(struct dm_kcopyd_client *kc,
57 dm_kcopyd_notify_fn fn, void *context);
58void dm_kcopyd_do_callback(void *job, int read_err, unsigned long write_err);
59
45#endif /* __KERNEL__ */ 60#endif /* __KERNEL__ */
46#endif /* _LINUX_DM_KCOPYD_H */ 61#endif /* _LINUX_DM_KCOPYD_H */