• Home
  • Raw
  • Download

Lines Matching refs:job

394 	struct kcopyd_job *job = NULL;  in pop()  local
400 job = list_entry(jobs->next, struct kcopyd_job, list); in pop()
401 list_del(&job->list); in pop()
405 return job; in pop()
408 static void push(struct list_head *jobs, struct kcopyd_job *job) in push() argument
411 struct dm_kcopyd_client *kc = job->kc; in push()
414 list_add_tail(&job->list, jobs); in push()
419 static void push_head(struct list_head *jobs, struct kcopyd_job *job) in push_head() argument
422 struct dm_kcopyd_client *kc = job->kc; in push_head()
425 list_add(&job->list, jobs); in push_head()
438 static int run_complete_job(struct kcopyd_job *job) in run_complete_job() argument
440 void *context = job->context; in run_complete_job()
441 int read_err = job->read_err; in run_complete_job()
442 unsigned long write_err = job->write_err; in run_complete_job()
443 dm_kcopyd_notify_fn fn = job->fn; in run_complete_job()
444 struct dm_kcopyd_client *kc = job->kc; in run_complete_job()
446 if (job->pages && job->pages != &zero_page_list) in run_complete_job()
447 kcopyd_put_pages(kc, job->pages); in run_complete_job()
452 if (job->master_job == job) in run_complete_job()
453 mempool_free(job, kc->job_pool); in run_complete_job()
466 struct kcopyd_job *job = (struct kcopyd_job *) context; in complete_io() local
467 struct dm_kcopyd_client *kc = job->kc; in complete_io()
472 if (job->rw & WRITE) in complete_io()
473 job->write_err |= error; in complete_io()
475 job->read_err = 1; in complete_io()
477 if (!test_bit(DM_KCOPYD_IGNORE_ERROR, &job->flags)) { in complete_io()
478 push(&kc->complete_jobs, job); in complete_io()
484 if (job->rw & WRITE) in complete_io()
485 push(&kc->complete_jobs, job); in complete_io()
488 job->rw = WRITE; in complete_io()
489 push(&kc->io_jobs, job); in complete_io()
499 static int run_io_job(struct kcopyd_job *job) in run_io_job() argument
503 .bi_rw = job->rw, in run_io_job()
505 .mem.ptr.pl = job->pages, in run_io_job()
508 .notify.context = job, in run_io_job()
509 .client = job->kc->io_client, in run_io_job()
512 io_job_start(job->kc->throttle); in run_io_job()
514 if (job->rw == READ) in run_io_job()
515 r = dm_io(&io_req, 1, &job->source, NULL); in run_io_job()
517 r = dm_io(&io_req, job->num_dests, job->dests, NULL); in run_io_job()
522 static int run_pages_job(struct kcopyd_job *job) in run_pages_job() argument
525 unsigned nr_pages = dm_div_up(job->dests[0].count, PAGE_SIZE >> 9); in run_pages_job()
527 r = kcopyd_get_pages(job->kc, nr_pages, &job->pages); in run_pages_job()
530 push(&job->kc->io_jobs, job); in run_pages_job()
548 struct kcopyd_job *job; in process_jobs() local
551 while ((job = pop(jobs, kc))) { in process_jobs()
553 r = fn(job); in process_jobs()
557 if (job->rw & WRITE) in process_jobs()
558 job->write_err = (unsigned long) -1L; in process_jobs()
560 job->read_err = 1; in process_jobs()
561 push(&kc->complete_jobs, job); in process_jobs()
570 push_head(jobs, job); in process_jobs()
613 static void dispatch_job(struct kcopyd_job *job) in dispatch_job() argument
615 struct dm_kcopyd_client *kc = job->kc; in dispatch_job()
617 if (unlikely(!job->source.count)) in dispatch_job()
618 push(&kc->callback_jobs, job); in dispatch_job()
619 else if (job->pages == &zero_page_list) in dispatch_job()
620 push(&kc->io_jobs, job); in dispatch_job()
622 push(&kc->pages_jobs, job); in dispatch_job()
633 struct kcopyd_job *job = sub_job->master_job; in segment_complete() local
634 struct dm_kcopyd_client *kc = job->kc; in segment_complete()
636 mutex_lock(&job->lock); in segment_complete()
640 job->read_err = 1; in segment_complete()
643 job->write_err |= write_err; in segment_complete()
648 if ((!job->read_err && !job->write_err) || in segment_complete()
649 test_bit(DM_KCOPYD_IGNORE_ERROR, &job->flags)) { in segment_complete()
651 progress = job->progress; in segment_complete()
652 count = job->source.count - progress; in segment_complete()
657 job->progress += count; in segment_complete()
660 mutex_unlock(&job->lock); in segment_complete()
665 *sub_job = *job; in segment_complete()
669 for (i = 0; i < job->num_dests; i++) { in segment_complete()
678 } else if (atomic_dec_and_test(&job->sub_jobs)) { in segment_complete()
689 push(&kc->complete_jobs, job); in segment_complete()
714 struct kcopyd_job *job; in dm_kcopyd_copy() local
721 job = mempool_alloc(kc->job_pool, GFP_NOIO); in dm_kcopyd_copy()
726 job->kc = kc; in dm_kcopyd_copy()
727 job->flags = flags; in dm_kcopyd_copy()
728 job->read_err = 0; in dm_kcopyd_copy()
729 job->write_err = 0; in dm_kcopyd_copy()
731 job->num_dests = num_dests; in dm_kcopyd_copy()
732 memcpy(&job->dests, dests, sizeof(*dests) * num_dests); in dm_kcopyd_copy()
735 job->source = *from; in dm_kcopyd_copy()
736 job->pages = NULL; in dm_kcopyd_copy()
737 job->rw = READ; in dm_kcopyd_copy()
739 memset(&job->source, 0, sizeof job->source); in dm_kcopyd_copy()
740 job->source.count = job->dests[0].count; in dm_kcopyd_copy()
741 job->pages = &zero_page_list; in dm_kcopyd_copy()
746 job->rw = WRITE | REQ_WRITE_SAME; in dm_kcopyd_copy()
747 for (i = 0; i < job->num_dests; i++) in dm_kcopyd_copy()
748 if (!bdev_write_same(job->dests[i].bdev)) { in dm_kcopyd_copy()
749 job->rw = WRITE; in dm_kcopyd_copy()
754 job->fn = fn; in dm_kcopyd_copy()
755 job->context = context; in dm_kcopyd_copy()
756 job->master_job = job; in dm_kcopyd_copy()
758 if (job->source.count <= SUB_JOB_SIZE) in dm_kcopyd_copy()
759 dispatch_job(job); in dm_kcopyd_copy()
761 mutex_init(&job->lock); in dm_kcopyd_copy()
762 job->progress = 0; in dm_kcopyd_copy()
763 split_job(job); in dm_kcopyd_copy()
781 struct kcopyd_job *job; in dm_kcopyd_prepare_callback() local
783 job = mempool_alloc(kc->job_pool, GFP_NOIO); in dm_kcopyd_prepare_callback()
785 memset(job, 0, sizeof(struct kcopyd_job)); in dm_kcopyd_prepare_callback()
786 job->kc = kc; in dm_kcopyd_prepare_callback()
787 job->fn = fn; in dm_kcopyd_prepare_callback()
788 job->context = context; in dm_kcopyd_prepare_callback()
789 job->master_job = job; in dm_kcopyd_prepare_callback()
793 return job; in dm_kcopyd_prepare_callback()
799 struct kcopyd_job *job = j; in dm_kcopyd_do_callback() local
800 struct dm_kcopyd_client *kc = job->kc; in dm_kcopyd_do_callback()
802 job->read_err = read_err; in dm_kcopyd_do_callback()
803 job->write_err = write_err; in dm_kcopyd_do_callback()
805 push(&kc->callback_jobs, job); in dm_kcopyd_do_callback()
815 int kcopyd_cancel(struct kcopyd_job *job, int block)