Revert "blk-mq: initialize req->q in allocation"
authorJens Axboe <axboe@fb.com>
Thu, 24 Apr 2014 14:50:38 +0000 (08:50 -0600)
committerJens Axboe <axboe@fb.com>
Thu, 24 Apr 2014 14:50:38 +0000 (08:50 -0600)
This reverts commit 6a3c8a3ac0e68dcfc2a01f4aa1ca0edd1a1701eb.

We need selective clearing of the request to make the init-at-free
time completely safe. Otherwise we end up stomping on
rq->atomic_flags, which we don't want to do.

block/blk-mq.c

index cea1bd87a4162093d04b0b28ef89b39dd9e648b7..7d5650d75aef3fe92054bd95e7b3910c4a77962e 100644 (file)
@@ -82,6 +82,7 @@ static struct request *__blk_mq_alloc_request(struct blk_mq_hw_ctx *hctx,
        tag = blk_mq_get_tag(hctx->tags, gfp, reserved);
        if (tag != BLK_MQ_TAG_FAIL) {
                rq = hctx->tags->rqs[tag];
+               blk_rq_init(hctx->queue, rq);
                rq->tag = tag;
 
                return rq;
@@ -186,7 +187,6 @@ static void blk_mq_rq_ctx_init(struct request_queue *q, struct blk_mq_ctx *ctx,
        if (blk_queue_io_stat(q))
                rw_flags |= REQ_IO_STAT;
 
-       rq->q = q;
        rq->mq_ctx = ctx;
        rq->cmd_flags = rw_flags;
        rq->start_time = jiffies;
@@ -258,7 +258,6 @@ static void __blk_mq_free_request(struct blk_mq_hw_ctx *hctx,
        const int tag = rq->tag;
        struct request_queue *q = rq->q;
 
-       blk_rq_init(hctx->queue, rq);
        blk_mq_put_tag(hctx->tags, tag);
        blk_mq_queue_exit(q);
 }
@@ -1195,7 +1194,6 @@ static struct blk_mq_tags *blk_mq_init_rq_map(struct blk_mq_tag_set *set,
                left -= to_do * rq_size;
                for (j = 0; j < to_do; j++) {
                        tags->rqs[i] = p;
-                       blk_rq_init(NULL, tags->rqs[i]);
                        if (set->ops->init_request) {
                                if (set->ops->init_request(set->driver_data,
                                                tags->rqs[i], hctx_idx, i,
This page took 0.047733 seconds and 5 git commands to generate.