Commit d852564f authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

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: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 793597a6
...@@ -264,46 +264,30 @@ __blk_mq_alloc_request(struct request_queue *q, struct blk_mq_hw_ctx *hctx, ...@@ -264,46 +264,30 @@ __blk_mq_alloc_request(struct request_queue *q, struct blk_mq_hw_ctx *hctx,
return NULL; return NULL;
} }
static struct request *blk_mq_alloc_request_pinned(struct request_queue *q, struct request *blk_mq_alloc_request(struct request_queue *q, int rw, gfp_t gfp,
int rw, gfp_t gfp,
bool reserved) bool reserved)
{ {
bool gfp_mask = gfp & ~__GFP_WAIT; struct blk_mq_ctx *ctx;
struct blk_mq_hw_ctx *hctx;
struct request *rq; struct request *rq;
do { if (blk_mq_queue_enter(q))
struct blk_mq_ctx *ctx = blk_mq_get_ctx(q); return NULL;
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)) { ctx = blk_mq_get_ctx(q);
blk_mq_put_ctx(ctx); hctx = q->mq_ops->map_queue(q, ctx->cpu);
break;
}
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_run_hw_queue(hctx);
blk_mq_put_ctx(ctx); blk_mq_put_ctx(ctx);
gfp_mask = gfp;
} while (1);
return rq; 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);
struct request *blk_mq_alloc_request(struct request_queue *q, int rw, gfp_t gfp, }
bool reserved) blk_mq_put_ctx(ctx);
{
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);
return rq; return rq;
} }
EXPORT_SYMBOL(blk_mq_alloc_request); EXPORT_SYMBOL(blk_mq_alloc_request);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment