From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: Bart Van Assche <bvanassche@acm.org>, Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v2 2/6] block: Introduce the blk_rq_is_zoned_seq_write() function
Date: Fri, 24 Jun 2022 09:15:35 +0900 [thread overview]
Message-ID: <c73a499e-0c9a-f47c-509c-56b972438b41@opensource.wdc.com> (raw)
In-Reply-To: <20220623232603.3751912-3-bvanassche@acm.org>
On 6/24/22 08:25, Bart Van Assche wrote:
> 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.
>
> Cc: Damien Le Moal <damien.lemoal@wdc.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Looks good.
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> ---
> block/blk-zoned.c | 14 +-------------
> include/linux/blk-mq.h | 23 +++++++++++++++++++++++
> 2 files changed, 24 insertions(+), 13 deletions(-)
>
> diff --git a/block/blk-zoned.c b/block/blk-zoned.c
> index 38cd840d8838..cafcbc508dfb 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_zoned_seq_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..d5930797b84d 100644
> --- a/include/linux/blk-mq.h
> +++ b/include/linux/blk-mq.h
> @@ -1136,6 +1136,24 @@ 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_zoned_seq_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
> + * a sequential write preferred zone.
> + */
> +static inline bool blk_rq_is_zoned_seq_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_zoned_seq_write(struct request *rq)
> +{
> + return false;
> +}
> +
> static inline bool blk_req_needs_zone_write_lock(struct request *rq)
> {
> return false;
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2022-06-24 0:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-23 23:25 [PATCH v2 0/6] Improve zoned storage write performance Bart Van Assche
2022-06-23 23:25 ` [PATCH v2 1/6] block: Document blk_queue_zone_is_seq() and blk_rq_zone_is_seq() Bart Van Assche
2022-06-24 0:10 ` Damien Le Moal
2022-06-23 23:25 ` [PATCH v2 2/6] block: Introduce the blk_rq_is_zoned_seq_write() function Bart Van Assche
2022-06-24 0:15 ` Damien Le Moal [this message]
2022-06-24 6:07 ` Christoph Hellwig
2022-06-24 16:35 ` Bart Van Assche
2022-06-23 23:26 ` [PATCH v2 3/6] block: Introduce a request queue flag for pipelining zoned writes Bart Van Assche
2022-06-24 0:19 ` Damien Le Moal
2022-06-24 16:29 ` Bart Van Assche
2022-06-23 23:26 ` [PATCH v2 4/6] block/mq-deadline: Only use zone locking if necessary Bart Van Assche
2022-06-24 0:24 ` Damien Le Moal
2022-06-23 23:26 ` [PATCH v2 5/6] block/null_blk: Refactor null_queue_rq() Bart Van Assche
2022-06-24 0:26 ` Damien Le Moal
2022-06-23 23:26 ` [PATCH v2 6/6] block/null_blk: Add support for pipelining zoned writes Bart Van Assche
2022-06-24 0:29 ` Damien Le Moal
2022-06-24 6:06 ` Christoph Hellwig
2022-06-24 16:45 ` Bart Van Assche
2022-06-25 9:25 ` Christoph Hellwig
2022-06-26 0:23 ` Bart Van Assche
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=c73a499e-0c9a-f47c-509c-56b972438b41@opensource.wdc.com \
--to=damien.lemoal@opensource.wdc.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=hch@lst.de \
--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).