diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2011-05-29 08:03:13 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2011-05-29 08:03:13 -0400 |
commit | fa34ce73072f90ecd90dcc43f29d82e70e5f8676 (patch) | |
tree | 26f9c986da4433fa8ed00a1685e34709997474b2 /drivers | |
parent | 5f43ba2950414dc0abf4ac44c397d88069056746 (diff) |
dm kcopyd: return client directly and not through a pointer
Return client directly from dm_kcopyd_client_create, not through a
parameter, making it consistent with dm_io_client_create.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/dm-kcopyd.c | 9 | ||||
-rw-r--r-- | drivers/md/dm-raid1.c | 6 | ||||
-rw-r--r-- | drivers/md/dm-snap.c | 5 |
3 files changed, 11 insertions, 9 deletions
diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c index 579647f8b4d2..819e37eaaeba 100644 --- a/drivers/md/dm-kcopyd.c +++ b/drivers/md/dm-kcopyd.c | |||
@@ -637,14 +637,14 @@ int kcopyd_cancel(struct kcopyd_job *job, int block) | |||
637 | /*----------------------------------------------------------------- | 637 | /*----------------------------------------------------------------- |
638 | * Client setup | 638 | * Client setup |
639 | *---------------------------------------------------------------*/ | 639 | *---------------------------------------------------------------*/ |
640 | int dm_kcopyd_client_create(struct dm_kcopyd_client **result) | 640 | struct dm_kcopyd_client *dm_kcopyd_client_create(void) |
641 | { | 641 | { |
642 | int r = -ENOMEM; | 642 | int r = -ENOMEM; |
643 | struct dm_kcopyd_client *kc; | 643 | struct dm_kcopyd_client *kc; |
644 | 644 | ||
645 | kc = kmalloc(sizeof(*kc), GFP_KERNEL); | 645 | kc = kmalloc(sizeof(*kc), GFP_KERNEL); |
646 | if (!kc) | 646 | if (!kc) |
647 | return -ENOMEM; | 647 | return ERR_PTR(-ENOMEM); |
648 | 648 | ||
649 | spin_lock_init(&kc->job_lock); | 649 | spin_lock_init(&kc->job_lock); |
650 | INIT_LIST_HEAD(&kc->complete_jobs); | 650 | INIT_LIST_HEAD(&kc->complete_jobs); |
@@ -676,8 +676,7 @@ int dm_kcopyd_client_create(struct dm_kcopyd_client **result) | |||
676 | init_waitqueue_head(&kc->destroyq); | 676 | init_waitqueue_head(&kc->destroyq); |
677 | atomic_set(&kc->nr_jobs, 0); | 677 | atomic_set(&kc->nr_jobs, 0); |
678 | 678 | ||
679 | *result = kc; | 679 | return kc; |
680 | return 0; | ||
681 | 680 | ||
682 | bad_io_client: | 681 | bad_io_client: |
683 | client_free_pages(kc); | 682 | client_free_pages(kc); |
@@ -688,7 +687,7 @@ bad_workqueue: | |||
688 | bad_slab: | 687 | bad_slab: |
689 | kfree(kc); | 688 | kfree(kc); |
690 | 689 | ||
691 | return r; | 690 | return ERR_PTR(r); |
692 | } | 691 | } |
693 | EXPORT_SYMBOL(dm_kcopyd_client_create); | 692 | EXPORT_SYMBOL(dm_kcopyd_client_create); |
694 | 693 | ||
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index 9defad045418..9bfd057be686 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -1115,9 +1115,11 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
1115 | goto err_destroy_wq; | 1115 | goto err_destroy_wq; |
1116 | } | 1116 | } |
1117 | 1117 | ||
1118 | r = dm_kcopyd_client_create(&ms->kcopyd_client); | 1118 | ms->kcopyd_client = dm_kcopyd_client_create(); |
1119 | if (r) | 1119 | if (IS_ERR(ms->kcopyd_client)) { |
1120 | r = PTR_ERR(ms->kcopyd_client); | ||
1120 | goto err_destroy_wq; | 1121 | goto err_destroy_wq; |
1122 | } | ||
1121 | 1123 | ||
1122 | wakeup_mirrord(ms); | 1124 | wakeup_mirrord(ms); |
1123 | return 0; | 1125 | return 0; |
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 5a2296de84a3..9ecff5f3023a 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -1111,8 +1111,9 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
1111 | goto bad_hash_tables; | 1111 | goto bad_hash_tables; |
1112 | } | 1112 | } |
1113 | 1113 | ||
1114 | r = dm_kcopyd_client_create(&s->kcopyd_client); | 1114 | s->kcopyd_client = dm_kcopyd_client_create(); |
1115 | if (r) { | 1115 | if (IS_ERR(s->kcopyd_client)) { |
1116 | r = PTR_ERR(s->kcopyd_client); | ||
1116 | ti->error = "Could not create kcopyd client"; | 1117 | ti->error = "Could not create kcopyd client"; |
1117 | goto bad_kcopyd; | 1118 | goto bad_kcopyd; |
1118 | } | 1119 | } |