summaryrefslogtreecommitdiffstats
path: root/block/blk-mq.h
diff options
context:
space:
mode:
authorMing Lei <tom.leiming@gmail.com>2014-05-31 18:43:37 +0200
committerJens Axboe <axboe@fb.com>2014-06-04 05:04:39 +0200
commitcb96a42cc1f50ba1c7b1e9b2343bec80b926107f (patch)
treec69f953fcd7d04288903abe73a0f92f155882bfd /block/blk-mq.h
parentblk-mq: move blk_mq_get_ctx/blk_mq_put_ctx to mq private header (diff)
downloadlinux-cb96a42cc1f50ba1c7b1e9b2343bec80b926107f.tar.xz
linux-cb96a42cc1f50ba1c7b1e9b2343bec80b926107f.zip
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 <tom.leiming@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq.h')
-rw-r--r--block/blk-mq.h23
1 files changed, 23 insertions, 0 deletions
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