aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2011-08-02 07:32:02 -0400
committerAlasdair G Kergon <agk@redhat.com>2011-08-02 07:32:02 -0400
commit5bf45a3dcdba9ff43959f7b5b44523fab254c19c (patch)
tree5306d66f4afd6336ee07dc59bd3ddf964b57e318
parent4622afb3f50e03ce6da42002e7ed3675dfafc187 (diff)
dm kcopyd: remove nr_pages field from job structure
The nr_pages field in struct kcopyd_job is only used temporarily in run_pages_job() to count the number of required pages. We can use a local variable instead. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
-rw-r--r--drivers/md/dm-kcopyd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c
index e7926fa1eef2..98725e119324 100644
--- a/drivers/md/dm-kcopyd.c
+++ b/drivers/md/dm-kcopyd.c
@@ -224,7 +224,6 @@ struct kcopyd_job {
224 unsigned int num_dests; 224 unsigned int num_dests;
225 struct dm_io_region dests[DM_KCOPYD_MAX_REGIONS]; 225 struct dm_io_region dests[DM_KCOPYD_MAX_REGIONS];
226 226
227 unsigned int nr_pages;
228 struct page_list *pages; 227 struct page_list *pages;
229 228
230 /* 229 /*
@@ -396,9 +395,9 @@ static int run_io_job(struct kcopyd_job *job)
396static int run_pages_job(struct kcopyd_job *job) 395static int run_pages_job(struct kcopyd_job *job)
397{ 396{
398 int r; 397 int r;
398 unsigned nr_pages = dm_div_up(job->dests[0].count, PAGE_SIZE >> 9);
399 399
400 job->nr_pages = dm_div_up(job->dests[0].count, PAGE_SIZE >> 9); 400 r = kcopyd_get_pages(job->kc, nr_pages, &job->pages);
401 r = kcopyd_get_pages(job->kc, job->nr_pages, &job->pages);
402 if (!r) { 401 if (!r) {
403 /* this job is ready for io */ 402 /* this job is ready for io */
404 push(&job->kc->io_jobs, job); 403 push(&job->kc->io_jobs, job);
@@ -600,7 +599,6 @@ int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
600 job->num_dests = num_dests; 599 job->num_dests = num_dests;
601 memcpy(&job->dests, dests, sizeof(*dests) * num_dests); 600 memcpy(&job->dests, dests, sizeof(*dests) * num_dests);
602 601
603 job->nr_pages = 0;
604 job->pages = NULL; 602 job->pages = NULL;
605 603
606 job->fn = fn; 604 job->fn = fn;