summaryrefslogtreecommitdiffstats
path: root/block/blk-mq.h
diff options
context:
space:
mode:
authorMing Lei2014-12-03 12:38:04 +0100
committerJens Axboe2014-12-09 05:37:08 +0100
commit19c66e59ce57e7b181625cbb408d48eb10837763 (patch)
tree4eb5617cb983d279305e7b9f7e65cf61f0175d2a /block/blk-mq.h
parentblk-mq: re-check for available tags after running the hardware queue (diff)
downloadkernel-qcow2-linux-19c66e59ce57e7b181625cbb408d48eb10837763.tar.gz
kernel-qcow2-linux-19c66e59ce57e7b181625cbb408d48eb10837763.tar.xz
kernel-qcow2-linux-19c66e59ce57e7b181625cbb408d48eb10837763.zip
blk-mq: prevent unmapped hw queue from being scheduled
When one hardware queue has no mapped software queues, it shouldn't have been scheduled. Otherwise WARNING or OOPS can triggered. blk_mq_hw_queue_mapped() helper is introduce for fixing the problem. Signed-off-by: Ming Lei <ming.lei@canonical.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq.h')
-rw-r--r--block/blk-mq.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/block/blk-mq.h b/block/blk-mq.h
index d567d5283ffa..206230e64f79 100644
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -115,4 +115,9 @@ static inline void blk_mq_set_alloc_data(struct blk_mq_alloc_data *data,
data->hctx = hctx;
}
+static inline bool blk_mq_hw_queue_mapped(struct blk_mq_hw_ctx *hctx)
+{
+ return hctx->nr_ctx && hctx->tags;
+}
+
#endif