blk-mq: add flag for drivers wanting blocking ->queue_rq() for-4.9/mq-async-run
authorJens Axboe <axboe@fb.com>
Wed, 21 Sep 2016 16:12:13 +0000 (10:12 -0600)
committerJens Axboe <axboe@fb.com>
Wed, 21 Sep 2016 16:12:13 +0000 (10:12 -0600)
If a driver sets BLK_MQ_F_BLOCKING, it is allowed to block in its
->queue_rq() handler. For that case, blk-mq ensures that we always
calls it from a safe context.

Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq.c
include/linux/blk-mq.h

index c29700010b5c8296564bf086636bf1b3ac5dd9be..eae2f12f011f901ac91cd7907e4f999a945bbc61 100644 (file)
@@ -908,7 +908,7 @@ void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async)
            !blk_mq_hw_queue_mapped(hctx)))
                return;
 
-       if (!async) {
+       if (!async && !(hctx->flags & BLK_MQ_F_BLOCKING)) {
                int cpu = get_cpu();
                if (cpumask_test_cpu(cpu, hctx->cpumask)) {
                        __blk_mq_run_hw_queue(hctx);
index fbcfdf3232437b675a7d74b5eb46ae72e56e351e..5daa0ef756dd29c2b3f3a59c564a6e08bb055b11 100644 (file)
@@ -155,6 +155,7 @@ enum {
        BLK_MQ_F_TAG_SHARED     = 1 << 1,
        BLK_MQ_F_SG_MERGE       = 1 << 2,
        BLK_MQ_F_DEFER_ISSUE    = 1 << 4,
+       BLK_MQ_F_BLOCKING       = 1 << 5,
        BLK_MQ_F_ALLOC_POLICY_START_BIT = 8,
        BLK_MQ_F_ALLOC_POLICY_BITS = 1,