]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
blk-mq: streamline blk_mq_get_request
authorChristoph Hellwig <hch@lst.de>
Fri, 16 Jun 2017 16:15:23 +0000 (18:15 +0200)
committerJens Axboe <axboe@kernel.dk>
Sun, 18 Jun 2017 16:08:55 +0000 (10:08 -0600)
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c

index 0b17351fccfcf97714b5d2223d49e36462cb5cd4..e056725679a82817a98084fdcf6a0ba7c5bacb1b 100644 (file)
@@ -302,24 +302,24 @@ static struct request *blk_mq_get_request(struct request_queue *q,
                        rq = e->type->ops.mq.get_request(q, op, data);
                        if (rq)
                                rq->rq_flags |= RQF_QUEUED;
-               } else
-                       rq = __blk_mq_alloc_request(data, op);
-       } else {
-               rq = __blk_mq_alloc_request(data, op);
+                       goto allocated;
+               }
        }
 
-       if (rq) {
-               if (!op_is_flush(op)) {
-                       rq->elv.icq = NULL;
-                       if (e && e->type->icq_cache)
-                               blk_mq_sched_assign_ioc(q, rq, bio);
-               }
-               data->hctx->queued++;
-               return rq;
+       rq = __blk_mq_alloc_request(data, op);
+allocated:
+       if (!rq) {
+               blk_queue_exit(q);
+               return NULL;
        }
 
-       blk_queue_exit(q);
-       return NULL;
+       if (!op_is_flush(op)) {
+               rq->elv.icq = NULL;
+               if (e && e->type->icq_cache)
+                       blk_mq_sched_assign_ioc(q, rq, bio);
+       }
+       data->hctx->queued++;
+       return rq;
 }
 
 struct request *blk_mq_alloc_request(struct request_queue *q, int rw,