diff options
author | Christoph Hellwig <hch@lst.de> | 2014-05-27 22:59:50 +0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-05-28 19:49:27 +0400 |
commit | d852564f8c88b0604490234fdeeb6fb47e4bcc7a (patch) | |
tree | f22de3dc4e779b047f83e67ca93983c7101e125e /block | |
parent | 793597a6a95675f4f85671cf747c1d92e7dbc295 (diff) | |
download | linux-d852564f8c88b0604490234fdeeb6fb47e4bcc7a.tar.xz |
blk-mq: remove blk_mq_alloc_request_pinned
We now only have one caller left and can open code it there in a cleaner
way.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-mq.c | 48 |
1 files changed, 16 insertions, 32 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 43f0c8ffa92a..ae14749b530c 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -264,46 +264,30 @@ __blk_mq_alloc_request(struct request_queue *q, struct blk_mq_hw_ctx *hctx, return NULL; } -static struct request *blk_mq_alloc_request_pinned(struct request_queue *q, - int rw, gfp_t gfp, - bool reserved) -{ - bool gfp_mask = gfp & ~__GFP_WAIT; - struct request *rq; - - do { - struct blk_mq_ctx *ctx = blk_mq_get_ctx(q); - struct blk_mq_hw_ctx *hctx = q->mq_ops->map_queue(q, ctx->cpu); - - rq = __blk_mq_alloc_request(q, hctx, ctx, rw, gfp_mask, - reserved); - if (rq) - break; - - if (!(gfp & __GFP_WAIT)) { - blk_mq_put_ctx(ctx); - break; - } - - __blk_mq_run_hw_queue(hctx); - blk_mq_put_ctx(ctx); - gfp_mask = gfp; - } while (1); - - return rq; -} - struct request *blk_mq_alloc_request(struct request_queue *q, int rw, gfp_t gfp, bool reserved) { + struct blk_mq_ctx *ctx; + struct blk_mq_hw_ctx *hctx; struct request *rq; if (blk_mq_queue_enter(q)) return NULL; - rq = blk_mq_alloc_request_pinned(q, rw, gfp, reserved); - if (rq) - blk_mq_put_ctx(rq->mq_ctx); + ctx = blk_mq_get_ctx(q); + hctx = q->mq_ops->map_queue(q, ctx->cpu); + + rq = __blk_mq_alloc_request(q, hctx, ctx, rw, gfp & ~__GFP_WAIT, + reserved); + if (!rq && (gfp & __GFP_WAIT)) { + __blk_mq_run_hw_queue(hctx); + blk_mq_put_ctx(ctx); + + ctx = blk_mq_get_ctx(q); + hctx = q->mq_ops->map_queue(q, ctx->cpu); + rq = __blk_mq_alloc_request(q, hctx, ctx, rw, gfp, reserved); + } + blk_mq_put_ctx(ctx); return rq; } EXPORT_SYMBOL(blk_mq_alloc_request); |