diff options
author | Ming Lei <tom.leiming@gmail.com> | 2014-06-01 00:43:37 +0800 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-06-03 21:04:39 -0600 |
commit | cb96a42cc1f50ba1c7b1e9b2343bec80b926107f (patch) | |
tree | c69f953fcd7d04288903abe73a0f92f155882bfd /block/blk-mq.h | |
parent | 1aecfe4887713838c79bc52f774609a57db4f988 (diff) | |
download | linux-cb96a42cc1f50ba1c7b1e9b2343bec80b926107f.tar.bz2 |
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.h | 23 |
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 |