From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Jaegeuk Kim <jaegeuk@kernel.org>,
Bart Van Assche <bvanassche@acm.org>,
Damien Le Moal <damien.lemoal@wdc.com>
Subject: [PATCH v3 2/8] block: Introduce the blk_rq_is_seq_zone_write() function
Date: Mon, 27 Jun 2022 16:43:29 -0700 [thread overview]
Message-ID: <20220627234335.1714393-3-bvanassche@acm.org> (raw)
In-Reply-To: <20220627234335.1714393-1-bvanassche@acm.org>
Introduce a function that makes it easy to verify whether a write
request is for a sequential write required or sequential write preferred
zone. Simplify blk_req_needs_zone_write_lock() by using the new function.
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
block/blk-zoned.c | 14 +-------------
include/linux/blk-mq.h | 25 ++++++++++++++++++++++++-
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 38cd840d8838..9da8cf1bb378 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -57,19 +57,7 @@ EXPORT_SYMBOL_GPL(blk_zone_cond_str);
*/
bool blk_req_needs_zone_write_lock(struct request *rq)
{
- if (!rq->q->seq_zones_wlock)
- return false;
-
- if (blk_rq_is_passthrough(rq))
- return false;
-
- switch (req_op(rq)) {
- case REQ_OP_WRITE_ZEROES:
- case REQ_OP_WRITE:
- return blk_rq_zone_is_seq(rq);
- default:
- return false;
- }
+ return rq->q->seq_zones_wlock && blk_rq_is_seq_zone_write(rq);
}
EXPORT_SYMBOL_GPL(blk_req_needs_zone_write_lock);
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 909d47e34b7c..ccfcac9db879 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -1129,13 +1129,31 @@ static inline unsigned int blk_rq_zone_no(struct request *rq)
* @rq: Request pointer.
*
* Return: true if and only if blk_rq_pos(@rq) refers either to a sequential
- * write required or a sequential write preferred zone.
+ * write required or to a sequential write preferred zone.
*/
static inline unsigned int blk_rq_zone_is_seq(struct request *rq)
{
return blk_queue_zone_is_seq(rq->q, blk_rq_pos(rq));
}
+/**
+ * blk_rq_is_seq_zone_write() - Whether @rq is a write request for a sequential zone.
+ * @rq: Request to examine.
+ *
+ * In this context sequential zone means either a sequential write required or
+ * to a sequential write preferred zone.
+ */
+static inline bool blk_rq_is_seq_zone_write(struct request *rq)
+{
+ switch (req_op(rq)) {
+ case REQ_OP_WRITE:
+ case REQ_OP_WRITE_ZEROES:
+ return blk_rq_zone_is_seq(rq);
+ default:
+ return false;
+ }
+}
+
bool blk_req_needs_zone_write_lock(struct request *rq);
bool blk_req_zone_write_trylock(struct request *rq);
void __blk_req_zone_write_lock(struct request *rq);
@@ -1166,6 +1184,11 @@ static inline bool blk_req_can_dispatch_to_zone(struct request *rq)
return !blk_req_zone_is_write_locked(rq);
}
#else /* CONFIG_BLK_DEV_ZONED */
+static inline bool blk_rq_is_seq_zone_write(struct request *rq)
+{
+ return false;
+}
+
static inline bool blk_req_needs_zone_write_lock(struct request *rq)
{
return false;
next prev parent reply other threads:[~2022-06-27 23:43 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-27 23:43 [PATCH v3 0/8] Improve zoned storage write performance Bart Van Assche
2022-06-27 23:43 ` [PATCH v3 1/8] block: Document blk_queue_zone_is_seq() and blk_rq_zone_is_seq() Bart Van Assche
2022-06-28 0:19 ` Chaitanya Kulkarni
2022-06-27 23:43 ` Bart Van Assche [this message]
2022-06-28 0:20 ` [PATCH v3 2/8] block: Introduce the blk_rq_is_seq_zone_write() function Chaitanya Kulkarni
2022-06-27 23:43 ` [PATCH v3 3/8] block: Introduce a request queue flag for pipelining zoned writes Bart Van Assche
2022-06-28 0:36 ` Chaitanya Kulkarni
2022-06-28 2:49 ` Bart Van Assche
2022-06-27 23:43 ` [PATCH v3 4/8] block/mq-deadline: Only use zone locking if necessary Bart Van Assche
2022-06-27 23:43 ` [PATCH v3 5/8] block/null_blk: Refactor null_queue_rq() Bart Van Assche
2022-06-28 0:37 ` Chaitanya Kulkarni
2022-06-27 23:43 ` [PATCH v3 6/8] block/null_blk: Add support for pipelining zoned writes Bart Van Assche
2022-06-28 0:39 ` Chaitanya Kulkarni
2022-06-28 16:17 ` Bart Van Assche
2022-06-27 23:43 ` [PATCH v3 7/8] nvme: Make the number of retries command specific Bart Van Assche
2022-06-28 0:48 ` Chaitanya Kulkarni
2022-06-28 2:48 ` Bart Van Assche
2022-06-27 23:43 ` [PATCH v3 8/8] nvme: Enable pipelining of zoned writes Bart Van Assche
2022-06-28 3:16 ` Keith Busch
2022-06-28 9:00 ` Chaitanya Kulkarni
2022-06-28 17:44 ` Bart Van Assche
2022-06-28 4:49 ` Christoph Hellwig
2022-06-28 16:30 ` Bart Van Assche
2022-06-29 5:51 ` Christoph Hellwig
2022-06-29 6:10 ` Christoph Hellwig
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=20220627234335.1714393-3-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@wdc.com \
--cc=hch@lst.de \
--cc=jaegeuk@kernel.org \
--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 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).