All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@fb.com>
To: <axboe@kernel.dk>, <linux-block@vger.kernel.org>
Cc: <jbacik@fb.com>, Jens Axboe <axboe@fb.com>
Subject: [PATCH 2/2] blk-mq: add flag for drivers wanting blocking ->queue_rq()
Date: Thu, 22 Sep 2016 08:53:00 -0600	[thread overview]
Message-ID: <1474555980-2787-3-git-send-email-axboe@fb.com> (raw)
In-Reply-To: <1474555980-2787-1-git-send-email-axboe@fb.com>

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         | 2 +-
 include/linux/blk-mq.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index c29700010b5c..eae2f12f011f 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -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);
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index fbcfdf323243..5daa0ef756dd 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -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,
 
-- 
2.7.4

  parent reply	other threads:[~2016-09-22 14:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 14:52 [PATCH 0/2]: Add option for async ->queue_rq Jens Axboe
2016-09-22 14:52 ` [PATCH 1/2] blk-mq: get rid of manual run of queue with __blk_mq_run_hw_queue() Jens Axboe
2016-09-22 14:56   ` Christoph Hellwig
2016-09-22 18:56   ` Christoph Hellwig
2016-09-22 20:29     ` Jens Axboe
2016-09-23 21:59     ` Sagi Grimberg
2016-09-23 21:56   ` Sagi Grimberg
2016-09-22 14:53 ` Jens Axboe [this message]
2016-09-22 14:59   ` [PATCH 2/2] blk-mq: add flag for drivers wanting blocking ->queue_rq() Christoph Hellwig
2016-09-22 15:03     ` Jens Axboe
2016-09-22 15:12       ` Christoph Hellwig
2016-09-22 15:17         ` Jens Axboe
2016-09-23  1:43           ` Ming Lei
2016-09-23  2:44             ` Josef Bacik
2016-09-23  1:35         ` Ming Lei
2016-09-22 15:04     ` Josef Bacik
2016-09-22 18:01 ` [PATCH 0/2]: Add option for async ->queue_rq Josef Bacik
2016-09-28  0:25 ` Bart Van Assche
2016-09-28 16:43   ` Omar Sandoval

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474555980-2787-3-git-send-email-axboe@fb.com \
    --to=axboe@fb.com \
    --cc=axboe@kernel.dk \
    --cc=jbacik@fb.com \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.