Because we allocate pages from page allocator, we don't need to large amount
of pages. Reserve just the minimum of pages needed to process one job.
The maximum job size is SUB_JOB_SIZE, thus we calculate the number of reserved
pages from this.
/*-----------------------------------------------------------------
* Each kcopyd client has its own little pool of preallocated
@@ -616,8 +617,7 @@ int kcopyd_cancel(struct kcopyd_job *job
/*-----------------------------------------------------------------
* Client setup
*---------------------------------------------------------------*/
-int dm_kcopyd_client_create(unsigned int nr_pages,
- struct dm_kcopyd_client **result)
+int dm_kcopyd_client_create(struct dm_kcopyd_client **result)
{
int r = -ENOMEM;
struct dm_kcopyd_client *kc;
@@ -643,7 +643,7 @@ int dm_kcopyd_client_create(unsigned int
kc->pages = NULL;
kc->nr_pages = kc->nr_free_pages = 0;
- r = client_alloc_pages(kc, nr_pages);
+ r = client_alloc_pages(kc, RESERVE_PAGES);
if (r)
goto bad_client_pages;
Index: linux-2.6.39-fast/include/linux/dm-kcopyd.h
================================================== =================
--- linux-2.6.39-fast.orig/include/linux/dm-kcopyd.h 2011-05-24 22:13:16.000000000 +0200
+++ linux-2.6.39-fast/include/linux/dm-kcopyd.h 2011-05-25 17:43:23.000000000 +0200
@@ -25,8 +25,7 @@
* To use kcopyd you must first create a dm_kcopyd_client object.
*/
struct dm_kcopyd_client;
-int dm_kcopyd_client_create(unsigned num_pages,
- struct dm_kcopyd_client **result);
+int dm_kcopyd_client_create(struct dm_kcopyd_client **result);
void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc);