diff options
author | Milan Broz <mbroz@redhat.com> | 2007-05-09 05:33:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 15:30:47 -0400 |
commit | 373a392bd76c4cc2cbbdab3906aee2ae4dc6702e (patch) | |
tree | 5adf4bf86e25abe107e0623dc3257a0e46b74670 /drivers/md/kcopyd.c | |
parent | c8b03afe3d38a635861e4bfa5c563d844e754a91 (diff) |
dm kcopyd: update dm io interface
This patch ports kcopyd.c to the new, scalable dm_io() interface.
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Heinz Mauelshagen <hjm@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md/kcopyd.c')
-rw-r--r-- | drivers/md/kcopyd.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/md/kcopyd.c b/drivers/md/kcopyd.c index b46f6c575f7e..dbc234e3c69f 100644 --- a/drivers/md/kcopyd.c +++ b/drivers/md/kcopyd.c | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2002 Sistina Software (UK) Limited. | 2 | * Copyright (C) 2002 Sistina Software (UK) Limited. |
3 | * Copyright (C) 2006 Red Hat GmbH | ||
3 | * | 4 | * |
4 | * This file is released under the GPL. | 5 | * This file is released under the GPL. |
5 | * | 6 | * |
@@ -45,6 +46,8 @@ struct kcopyd_client { | |||
45 | unsigned int nr_pages; | 46 | unsigned int nr_pages; |
46 | unsigned int nr_free_pages; | 47 | unsigned int nr_free_pages; |
47 | 48 | ||
49 | struct dm_io_client *io_client; | ||
50 | |||
48 | wait_queue_head_t destroyq; | 51 | wait_queue_head_t destroyq; |
49 | atomic_t nr_jobs; | 52 | atomic_t nr_jobs; |
50 | }; | 53 | }; |
@@ -342,16 +345,20 @@ static void complete_io(unsigned long error, void *context) | |||
342 | static int run_io_job(struct kcopyd_job *job) | 345 | static int run_io_job(struct kcopyd_job *job) |
343 | { | 346 | { |
344 | int r; | 347 | int r; |
348 | struct dm_io_request io_req = { | ||
349 | .bi_rw = job->rw, | ||
350 | .mem.type = DM_IO_PAGE_LIST, | ||
351 | .mem.ptr.pl = job->pages, | ||
352 | .mem.offset = job->offset, | ||
353 | .notify.fn = complete_io, | ||
354 | .notify.context = job, | ||
355 | .client = job->kc->io_client, | ||
356 | }; | ||
345 | 357 | ||
346 | if (job->rw == READ) | 358 | if (job->rw == READ) |
347 | r = dm_io_async(1, &job->source, job->rw, | 359 | r = dm_io(&io_req, 1, &job->source, NULL); |
348 | job->pages, | ||
349 | job->offset, complete_io, job); | ||
350 | |||
351 | else | 360 | else |
352 | r = dm_io_async(job->num_dests, job->dests, job->rw, | 361 | r = dm_io(&io_req, job->num_dests, job->dests, NULL); |
353 | job->pages, | ||
354 | job->offset, complete_io, job); | ||
355 | 362 | ||
356 | return r; | 363 | return r; |
357 | } | 364 | } |
@@ -670,8 +677,9 @@ int kcopyd_client_create(unsigned int nr_pages, struct kcopyd_client **result) | |||
670 | return r; | 677 | return r; |
671 | } | 678 | } |
672 | 679 | ||
673 | r = dm_io_get(nr_pages); | 680 | kc->io_client = dm_io_client_create(nr_pages); |
674 | if (r) { | 681 | if (IS_ERR(kc->io_client)) { |
682 | r = PTR_ERR(kc->io_client); | ||
675 | client_free_pages(kc); | 683 | client_free_pages(kc); |
676 | kfree(kc); | 684 | kfree(kc); |
677 | kcopyd_exit(); | 685 | kcopyd_exit(); |
@@ -691,7 +699,7 @@ void kcopyd_client_destroy(struct kcopyd_client *kc) | |||
691 | /* Wait for completion of all jobs submitted by this client. */ | 699 | /* Wait for completion of all jobs submitted by this client. */ |
692 | wait_event(kc->destroyq, !atomic_read(&kc->nr_jobs)); | 700 | wait_event(kc->destroyq, !atomic_read(&kc->nr_jobs)); |
693 | 701 | ||
694 | dm_io_put(kc->nr_pages); | 702 | dm_io_client_destroy(kc->io_client); |
695 | client_free_pages(kc); | 703 | client_free_pages(kc); |
696 | client_del(kc); | 704 | client_del(kc); |
697 | kfree(kc); | 705 | kfree(kc); |