linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Mike Snitzer <snitzer@redhat.com>
Cc: dm-devel-redhat.com@suse.de,
	Damien Le Moal <damien.lemoal@hgst.com>,
	linux-scsi@vger.kernel.org, linux-block@vger.kernel.org,
	Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@fb.com>,
	Hannes Reinecke <hare@suse.de>
Subject: [PATCH 1/3] block: add flag for single-threaded submission
Date: Tue, 19 Jul 2016 16:02:56 +0200	[thread overview]
Message-ID: <1468936978-9124-2-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1468936978-9124-1-git-send-email-hare@suse.de>

Some devices (most notably SMR drives) support only
one I/O stream eg for ensuring ordered I/O submission.
This patch adds a new block queue flag
'BLK_QUEUE_SINGLE' to support these devices.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 block/blk-core.c       | 2 ++
 include/linux/blkdev.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/block/blk-core.c b/block/blk-core.c
index 4bcf30a..ff08d77 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -320,6 +320,8 @@ inline void __blk_run_queue_uncond(struct request_queue *q)
 	 * number of active request_fn invocations such that blk_drain_queue()
 	 * can wait until all these request_fn calls have finished.
 	 */
+	if (blk_queue_single(q) && q->request_fn_active)
+		return;
 	q->request_fn_active++;
 	q->request_fn(q);
 	q->request_fn_active--;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index c351444..2f7775a 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -539,6 +539,7 @@ struct request_queue {
 #define QUEUE_FLAG_WC	       23	/* Write back caching */
 #define QUEUE_FLAG_FUA	       24	/* device supports FUA writes */
 #define QUEUE_FLAG_FLUSH_NQ    25	/* flush not queueuable */
+#define QUEUE_FLAG_SINGLE      26	/* single-threaded submission only */
 
 #define QUEUE_FLAG_DEFAULT	((1 << QUEUE_FLAG_IO_STAT) |		\
 				 (1 << QUEUE_FLAG_STACKABLE)	|	\
@@ -628,6 +629,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
 #define blk_queue_discard(q)	test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags)
 #define blk_queue_secdiscard(q)	(blk_queue_discard(q) && \
 	test_bit(QUEUE_FLAG_SECDISCARD, &(q)->queue_flags))
+#define blk_queue_single(q)	test_bit(QUEUE_FLAG_SINGLE, &(q)->queue_flags)
 
 #define blk_noretry_request(rq) \
 	((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \
-- 
1.8.5.6


  reply	other threads:[~2016-07-19 14:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-19 14:02 [PATCH 0/3] dm-zoned target for ZBC devices Hannes Reinecke
2016-07-19 14:02 ` Hannes Reinecke [this message]
2016-07-20  1:13   ` [PATCH 1/3] block: add flag for single-threaded submission Damien Le Moal
2016-07-21  5:54   ` Christoph Hellwig
2016-07-21  6:01     ` Hannes Reinecke
2016-07-21  6:37       ` Hannes Reinecke
2016-07-21  7:10         ` Damien Le Moal
2016-07-21 14:38         ` Christoph Hellwig
2016-07-19 14:02 ` [PATCH 2/3] sd: enable single-threaded I/O submission for zoned devices Hannes Reinecke
2016-07-20  1:15   ` Damien Le Moal
2016-07-19 14:02 ` [PATCH 3/3] dm-zoned: New device mapper target for zoned block devices Hannes Reinecke

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=1468936978-9124-2-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    --cc=axboe@fb.com \
    --cc=damien.lemoal@hgst.com \
    --cc=dm-devel-redhat.com@suse.de \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=snitzer@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).