aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-kcopyd.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2011-05-29 08:03:11 -0400
committerAlasdair G Kergon <agk@redhat.com>2011-05-29 08:03:11 -0400
commit5f43ba2950414dc0abf4ac44c397d88069056746 (patch)
treef80df9947ef30f965d9c33e649d1856f1e47220f /drivers/md/dm-kcopyd.c
parentbda8efec5c706a672e0714d341a342e811f0262a (diff)
dm kcopyd: reserve fewer pages
Reserve just the minimum of pages needed to process one job. Because we allocate pages from page allocator, we don't need to reserve a large number of pages. The maximum job size is SUB_JOB_SIZE and we calculate the number of reserved pages based on this. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-kcopyd.c')
-rw-r--r--drivers/md/dm-kcopyd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c
index 719693340d1d..579647f8b4d2 100644
--- a/drivers/md/dm-kcopyd.c
+++ b/drivers/md/dm-kcopyd.c
@@ -30,6 +30,7 @@
30#define SUB_JOB_SIZE 128 30#define SUB_JOB_SIZE 128
31#define SPLIT_COUNT 8 31#define SPLIT_COUNT 8
32#define MIN_JOBS 8 32#define MIN_JOBS 8
33#define RESERVE_PAGES (DIV_ROUND_UP(SUB_JOB_SIZE << SECTOR_SHIFT, PAGE_SIZE))
33 34
34/*----------------------------------------------------------------- 35/*-----------------------------------------------------------------
35 * Each kcopyd client has its own little pool of preallocated 36 * Each kcopyd client has its own little pool of preallocated
@@ -636,8 +637,7 @@ int kcopyd_cancel(struct kcopyd_job *job, int block)
636/*----------------------------------------------------------------- 637/*-----------------------------------------------------------------
637 * Client setup 638 * Client setup
638 *---------------------------------------------------------------*/ 639 *---------------------------------------------------------------*/
639int dm_kcopyd_client_create(unsigned min_pages, 640int dm_kcopyd_client_create(struct dm_kcopyd_client **result)
640 struct dm_kcopyd_client **result)
641{ 641{
642 int r = -ENOMEM; 642 int r = -ENOMEM;
643 struct dm_kcopyd_client *kc; 643 struct dm_kcopyd_client *kc;
@@ -663,7 +663,7 @@ int dm_kcopyd_client_create(unsigned min_pages,
663 663
664 kc->pages = NULL; 664 kc->pages = NULL;
665 kc->nr_reserved_pages = kc->nr_free_pages = 0; 665 kc->nr_reserved_pages = kc->nr_free_pages = 0;
666 r = client_reserve_pages(kc, min_pages); 666 r = client_reserve_pages(kc, RESERVE_PAGES);
667 if (r) 667 if (r)
668 goto bad_client_pages; 668 goto bad_client_pages;
669 669