Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 252805
b: refs/heads/master
c: fa34ce7
h: refs/heads/master
i:
  252803: bfb232c
v: v3
  • Loading branch information
Mikulas Patocka authored and Alasdair G Kergon committed May 29, 2011
1 parent ec7fc03 commit d1ea2d7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5f43ba2950414dc0abf4ac44c397d88069056746
refs/heads/master: fa34ce73072f90ecd90dcc43f29d82e70e5f8676
9 changes: 4 additions & 5 deletions trunk/drivers/md/dm-kcopyd.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,14 +637,14 @@ int kcopyd_cancel(struct kcopyd_job *job, int block)
/*-----------------------------------------------------------------
* Client setup
*---------------------------------------------------------------*/
int dm_kcopyd_client_create(struct dm_kcopyd_client **result)
struct dm_kcopyd_client *dm_kcopyd_client_create(void)
{
int r = -ENOMEM;
struct dm_kcopyd_client *kc;

kc = kmalloc(sizeof(*kc), GFP_KERNEL);
if (!kc)
return -ENOMEM;
return ERR_PTR(-ENOMEM);

spin_lock_init(&kc->job_lock);
INIT_LIST_HEAD(&kc->complete_jobs);
Expand Down Expand Up @@ -676,8 +676,7 @@ int dm_kcopyd_client_create(struct dm_kcopyd_client **result)
init_waitqueue_head(&kc->destroyq);
atomic_set(&kc->nr_jobs, 0);

*result = kc;
return 0;
return kc;

bad_io_client:
client_free_pages(kc);
Expand All @@ -688,7 +687,7 @@ int dm_kcopyd_client_create(struct dm_kcopyd_client **result)
bad_slab:
kfree(kc);

return r;
return ERR_PTR(r);
}
EXPORT_SYMBOL(dm_kcopyd_client_create);

Expand Down
6 changes: 4 additions & 2 deletions trunk/drivers/md/dm-raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,9 +1115,11 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv)
goto err_destroy_wq;
}

r = dm_kcopyd_client_create(&ms->kcopyd_client);
if (r)
ms->kcopyd_client = dm_kcopyd_client_create();
if (IS_ERR(ms->kcopyd_client)) {
r = PTR_ERR(ms->kcopyd_client);
goto err_destroy_wq;
}

wakeup_mirrord(ms);
return 0;
Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/md/dm-snap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1111,8 +1111,9 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
goto bad_hash_tables;
}

r = dm_kcopyd_client_create(&s->kcopyd_client);
if (r) {
s->kcopyd_client = dm_kcopyd_client_create();
if (IS_ERR(s->kcopyd_client)) {
r = PTR_ERR(s->kcopyd_client);
ti->error = "Could not create kcopyd client";
goto bad_kcopyd;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/dm-kcopyd.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* To use kcopyd you must first create a dm_kcopyd_client object.
*/
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);

/*
Expand Down

0 comments on commit d1ea2d7

Please sign in to comment.