block: remove per-queue plugging
[sfrench/cifs-2.6.git] / drivers / md / dm-kcopyd.c
index d8587bac5682f41673cc9a20695a146c30415a31..400cf35094a4ef752a7fafbb9d9a9305818997af 100644 (file)
@@ -345,7 +345,7 @@ static int run_io_job(struct kcopyd_job *job)
 {
        int r;
        struct dm_io_request io_req = {
-               .bi_rw = job->rw | REQ_SYNC | REQ_UNPLUG,
+               .bi_rw = job->rw,
                .mem.type = DM_IO_PAGE_LIST,
                .mem.ptr.pl = job->pages,
                .mem.offset = job->offset,
@@ -356,8 +356,11 @@ static int run_io_job(struct kcopyd_job *job)
 
        if (job->rw == READ)
                r = dm_io(&io_req, 1, &job->source, NULL);
-       else
+       else {
+               if (job->num_dests > 1)
+                       io_req.bi_rw |= REQ_UNPLUG;
                r = dm_io(&io_req, job->num_dests, job->dests, NULL);
+       }
 
        return r;
 }
@@ -428,6 +431,7 @@ static void do_work(struct work_struct *work)
 {
        struct dm_kcopyd_client *kc = container_of(work,
                                        struct dm_kcopyd_client, kcopyd_work);
+       struct blk_plug plug;
 
        /*
         * The order that these are called is *very* important.
@@ -436,9 +440,11 @@ static void do_work(struct work_struct *work)
         * list.  io jobs call wake when they complete and it all
         * starts again.
         */
+       blk_start_plug(&plug);
        process_jobs(&kc->complete_jobs, kc, run_complete_job);
        process_jobs(&kc->pages_jobs, kc, run_pages_job);
        process_jobs(&kc->io_jobs, kc, run_io_job);
+       blk_finish_plug(&plug);
 }
 
 /*
@@ -624,7 +630,8 @@ int dm_kcopyd_client_create(unsigned int nr_pages,
                goto bad_slab;
 
        INIT_WORK(&kc->kcopyd_work, do_work);
-       kc->kcopyd_wq = create_singlethread_workqueue("kcopyd");
+       kc->kcopyd_wq = alloc_workqueue("kcopyd",
+                                       WQ_NON_REENTRANT | WQ_MEM_RECLAIM, 0);
        if (!kc->kcopyd_wq)
                goto bad_workqueue;