Hi Does this patch help in your tests? In my tests, it improves performance by about 20%. Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx> Index: linux-2.6/drivers/md/dm-kcopyd.c =================================================================== --- linux-2.6.orig/drivers/md/dm-kcopyd.c +++ linux-2.6/drivers/md/dm-kcopyd.c @@ -896,6 +896,12 @@ void dm_kcopyd_do_callback(void *j, int } EXPORT_SYMBOL(dm_kcopyd_do_callback); +void dm_kcopyd_wait_if_busy(struct dm_kcopyd_client *kc) +{ + flush_workqueue(kc->kcopyd_wq); +} +EXPORT_SYMBOL(dm_kcopyd_wait_if_busy); + /* * Cancels a kcopyd job, eg. someone might be deactivating a * mirror. Index: linux-2.6/drivers/md/dm-writecache.c =================================================================== --- linux-2.6.orig/drivers/md/dm-writecache.c +++ linux-2.6/drivers/md/dm-writecache.c @@ -1815,6 +1815,9 @@ static void writecache_writeback(struct struct writeback_list wbl; unsigned long n_walked; + if (!WC_MODE_PMEM(wc)) + dm_kcopyd_wait_if_busy(wc->dm_kcopyd); + wc_lock(wc); restart: if (writecache_has_error(wc)) { Index: linux-2.6/include/linux/dm-kcopyd.h =================================================================== --- linux-2.6.orig/include/linux/dm-kcopyd.h +++ linux-2.6/include/linux/dm-kcopyd.h @@ -82,6 +82,8 @@ void *dm_kcopyd_prepare_callback(struct dm_kcopyd_notify_fn fn, void *context); void dm_kcopyd_do_callback(void *job, int read_err, unsigned long write_err); +void dm_kcopyd_wait_if_busy(struct dm_kcopyd_client *kc); + void dm_kcopyd_zero(struct dm_kcopyd_client *kc, unsigned num_dests, struct dm_io_region *dests, unsigned flags, dm_kcopyd_notify_fn fn, void *context); -- dm-devel mailing list dm-devel@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/dm-devel