block: require blk_rq_prep_clone() be given an initialized clone request
authorKeith Busch <keith.busch@intel.com>
Fri, 17 Oct 2014 23:46:35 +0000 (17:46 -0600)
committerJens Axboe <axboe@fb.com>
Wed, 28 Jan 2015 16:44:11 +0000 (09:44 -0700)
Prepare to allow blk_rq_prep_clone() to accept clone requests that were
allocated from blk-mq request queues.  As such the blk_rq_prep_clone()
caller must first initialize the clone request.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-core.c
drivers/md/dm.c

index 3ad405571dcc5105a52da4284477a187db936f64..1b5fa214efa37c89f0f3177c2e8d5186bbf131bc 100644 (file)
@@ -2945,8 +2945,6 @@ int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
        if (!bs)
                bs = fs_bio_set;
 
-       blk_rq_init(NULL, rq);
-
        __rq_for_each_bio(bio_src, rq_src) {
                bio = bio_clone_fast(bio_src, gfp_mask, bs);
                if (!bio)
index b98cd9d84435fe15ea1cb202850508f83b83204b..f251633a51af28e43cb43aba9f161dd6762cae24 100644 (file)
@@ -1719,6 +1719,7 @@ static int setup_clone(struct request *clone, struct request *rq,
 {
        int r;
 
+       blk_rq_init(NULL, rq);
        r = blk_rq_prep_clone(clone, rq, tio->md->bs, GFP_ATOMIC,
                              dm_rq_bio_constructor, tio);
        if (r)