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>
This commit is contained in:
Mikulas Patocka 2011-05-29 13:03:13 +01:00 коммит произвёл Alasdair G Kergon
Родитель 5f43ba2950
Коммит fa34ce7307
4 изменённых файлов: 12 добавлений и 10 удалений

Просмотреть файл

@ -637,14 +637,14 @@ int kcopyd_cancel(struct kcopyd_job *job, int block)
/*----------------------------------------------------------------- /*-----------------------------------------------------------------
* Client setup * Client setup
*---------------------------------------------------------------*/ *---------------------------------------------------------------*/
int dm_kcopyd_client_create(struct dm_kcopyd_client **result) struct dm_kcopyd_client *dm_kcopyd_client_create(void)
{ {
int r = -ENOMEM; int r = -ENOMEM;
struct dm_kcopyd_client *kc; struct dm_kcopyd_client *kc;
kc = kmalloc(sizeof(*kc), GFP_KERNEL); kc = kmalloc(sizeof(*kc), GFP_KERNEL);
if (!kc) if (!kc)
return -ENOMEM; return ERR_PTR(-ENOMEM);
spin_lock_init(&kc->job_lock); spin_lock_init(&kc->job_lock);
INIT_LIST_HEAD(&kc->complete_jobs); INIT_LIST_HEAD(&kc->complete_jobs);
@ -676,8 +676,7 @@ int dm_kcopyd_client_create(struct dm_kcopyd_client **result)
init_waitqueue_head(&kc->destroyq); init_waitqueue_head(&kc->destroyq);
atomic_set(&kc->nr_jobs, 0); atomic_set(&kc->nr_jobs, 0);
*result = kc; return kc;
return 0;
bad_io_client: bad_io_client:
client_free_pages(kc); client_free_pages(kc);
@ -688,7 +687,7 @@ bad_workqueue:
bad_slab: bad_slab:
kfree(kc); kfree(kc);
return r; return ERR_PTR(r);
} }
EXPORT_SYMBOL(dm_kcopyd_client_create); EXPORT_SYMBOL(dm_kcopyd_client_create);

Просмотреть файл

@ -1115,9 +1115,11 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv)
goto err_destroy_wq; goto err_destroy_wq;
} }
r = dm_kcopyd_client_create(&ms->kcopyd_client); ms->kcopyd_client = dm_kcopyd_client_create();
if (r) if (IS_ERR(ms->kcopyd_client)) {
r = PTR_ERR(ms->kcopyd_client);
goto err_destroy_wq; goto err_destroy_wq;
}
wakeup_mirrord(ms); wakeup_mirrord(ms);
return 0; return 0;

Просмотреть файл

@ -1111,8 +1111,9 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
goto bad_hash_tables; goto bad_hash_tables;
} }
r = dm_kcopyd_client_create(&s->kcopyd_client); s->kcopyd_client = dm_kcopyd_client_create();
if (r) { if (IS_ERR(s->kcopyd_client)) {
r = PTR_ERR(s->kcopyd_client);
ti->error = "Could not create kcopyd client"; ti->error = "Could not create kcopyd client";
goto bad_kcopyd; goto bad_kcopyd;
} }

Просмотреть файл

@ -25,7 +25,7 @@
* To use kcopyd you must first create a dm_kcopyd_client object. * To use kcopyd you must first create a dm_kcopyd_client object.
*/ */
struct dm_kcopyd_client; struct dm_kcopyd_client;
int dm_kcopyd_client_create(struct dm_kcopyd_client **result); struct dm_kcopyd_client *dm_kcopyd_client_create(void);
void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc); void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc);
/* /*