From cb96a42cc1f50ba1c7b1e9b2343bec80b926107f Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Sun, 1 Jun 2014 00:43:37 +0800 Subject: blk-mq: fix schedule from atomic context blk_mq_put_ctx() has to be called before io_schedule() in bt_get(). This patch fixes the problem by taking similar approach from percpu_ida allocation for the situation. Signed-off-by: Ming Lei Signed-off-by: Jens Axboe --- block/blk-mq.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'block/blk-mq.h') diff --git a/block/blk-mq.h b/block/blk-mq.h index 57a7968e47b3..26460884c6cd 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h @@ -91,4 +91,27 @@ static inline void blk_mq_put_ctx(struct blk_mq_ctx *ctx) put_cpu(); } +struct blk_mq_alloc_data { + /* input parameter */ + struct request_queue *q; + gfp_t gfp; + bool reserved; + + /* input & output parameter */ + struct blk_mq_ctx *ctx; + struct blk_mq_hw_ctx *hctx; +}; + +static inline void blk_mq_set_alloc_data(struct blk_mq_alloc_data *data, + struct request_queue *q, gfp_t gfp, bool reserved, + struct blk_mq_ctx *ctx, + struct blk_mq_hw_ctx *hctx) +{ + data->q = q; + data->gfp = gfp; + data->reserved = reserved; + data->ctx = ctx; + data->hctx = hctx; +} + #endif -- cgit v1.2.3-70-g09d2