This patch ports kcopyd.c to the new, scalable dm_io() interface. Signed-off-by: Milan Broz Signed-off-by: Heinz Mauelshagen Index: linux-2.6.18-rc7/drivers/md/kcopyd.c =================================================================== --- linux-2.6.18-rc7.orig/drivers/md/kcopyd.c 2006-10-13 17:10:20.000000000 +0100 +++ linux-2.6.18-rc7/drivers/md/kcopyd.c 2006-10-13 17:10:25.000000000 +0100 @@ -1,5 +1,6 @@ /* * Copyright (C) 2002 Sistina Software (UK) Limited. + * Copyright (C) 2006 Red Hat GmbH * * This file is released under the GPL. * @@ -45,6 +46,7 @@ struct kcopyd_client { unsigned int nr_pages; unsigned int nr_free_pages; + void *dm_io_client; wait_queue_head_t destroyq; atomic_t nr_jobs; }; @@ -342,16 +344,20 @@ static void complete_io(unsigned long er static int run_io_job(struct kcopyd_job *job) { int r; + struct io_control control = { + .rw = job->rw, + .sync = 0, + .mem.type = IO_PAGE_LIST, + .mem.ptr.pl = job->pages, + .mem.offset = job->offset, + .notify.fn = complete_io, + .notify.context = job, + }; if (job->rw == READ) - r = dm_io_async(1, &job->source, job->rw, - job->pages, - job->offset, complete_io, job); - + r = dm_io(job->kc->dm_io_client, &control, 1, &job->source, NULL); else - r = dm_io_async(job->num_dests, job->dests, job->rw, - job->pages, - job->offset, complete_io, job); + r = dm_io(job->kc->dm_io_client, &control, job->num_dests, job->dests, NULL); return r; } @@ -670,12 +676,12 @@ int kcopyd_client_create(unsigned int nr return r; } - r = dm_io_get(nr_pages); - if (r) { + kc->dm_io_client = dm_io_client_create(nr_pages); + if (!kc->dm_io_client) { client_free_pages(kc); kfree(kc); kcopyd_exit(); - return r; + return -ENOMEM; } init_waitqueue_head(&kc->destroyq); @@ -692,7 +698,7 @@ void kcopyd_client_destroy(struct kcopyd /* Wait for completion of all jobs submitted by this client. */ wait_event(kc->destroyq, !atomic_read(&kc->nr_jobs)); - dm_io_put(kc->nr_pages); + dm_io_client_destroy(kc->dm_io_client); client_free_pages(kc); client_del(kc); kfree(kc);