From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: Pankaj Raghav <p.raghav@samsung.com>, axboe@kernel.dk, hch@lst.de
Cc: gost.dev@samsung.com, linux-block@vger.kernel.org
Subject: Re: [PATCH v3 1/2] block: adapt blk_mq_plug() to not plug for writes that require a zone lock
Date: Thu, 29 Sep 2022 17:14:37 +0900 [thread overview]
Message-ID: <c34ce7f3-8bf2-99c0-9c82-ea6691f762ef@opensource.wdc.com> (raw)
In-Reply-To: <20220929074745.103073-2-p.raghav@samsung.com>
On 9/29/22 16:47, Pankaj Raghav wrote:
> The current implementation of blk_mq_plug() disables plugging for all
> operations that involves a transfer to the device as we just check if
> the last bit in op_is_write() function.
>
> Modify blk_mq_plug() to disable plugging only for REQ_OP_WRITE and
> REQ_OP_WRITE_ZEROS as they might require a zone lock.
>
> Suggested-by: Christoph Hellwig <hch@lst.de>
> Suggested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> ---
> block/blk-mq.h | 3 ++-
> block/blk-zoned.c | 9 +++------
> include/linux/blkdev.h | 9 +++++++++
> 3 files changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/block/blk-mq.h b/block/blk-mq.h
> index 8ca453ac243d..0b2870839cdd 100644
> --- a/block/blk-mq.h
> +++ b/block/blk-mq.h
> @@ -312,7 +312,8 @@ static inline void blk_mq_clear_mq_map(struct blk_mq_queue_map *qmap)
> static inline struct blk_plug *blk_mq_plug( struct bio *bio)
> {
> /* Zoned block device write operation case: do not plug the BIO */
> - if (bdev_is_zoned(bio->bi_bdev) && op_is_write(bio_op(bio)))
> + if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
> + bdev_op_is_zoned_write(bio->bi_bdev, bio_op(bio)))
> return NULL;
>
> /*
> diff --git a/block/blk-zoned.c b/block/blk-zoned.c
> index a264621d4905..db829401d8d0 100644
> --- a/block/blk-zoned.c
> +++ b/block/blk-zoned.c
> @@ -63,13 +63,10 @@ bool blk_req_needs_zone_write_lock(struct request *rq)
> if (!rq->q->disk->seq_zones_wlock)
> return false;
>
> - switch (req_op(rq)) {
> - case REQ_OP_WRITE_ZEROES:
> - case REQ_OP_WRITE:
> + if (bdev_op_is_zoned_write(rq->q->disk->part0, req_op(rq)))
> return blk_rq_zone_is_seq(rq);
> - default:
> - return false;
> - }
> +
> + return false;
> }
> EXPORT_SYMBOL_GPL(blk_req_needs_zone_write_lock);
>
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 8038c5fbde40..74bc30c680d6 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1300,6 +1300,15 @@ static inline bool bdev_is_zoned(struct block_device *bdev)
> return false;
> }
>
> +static inline bool bdev_op_is_zoned_write(struct block_device *bdev,
> + blk_opf_t op)
> +{
> + if (!bdev_is_zoned(bdev))
> + return false;
> +
> + return op == REQ_OP_WRITE || op == REQ_OP_WRITE_ZEROES;
> +}
> +
> static inline sector_t bdev_zone_sectors(struct block_device *bdev)
> {
> struct request_queue *q = bdev_get_queue(bdev);
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2022-09-29 8:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20220929074747eucas1p1821a5b79ad24cb559b7b6ec324239e9e@eucas1p1.samsung.com>
2022-09-29 7:47 ` [PATCH v3 0/2] plugging cleanup v3 Pankaj Raghav
2022-09-29 7:47 ` [PATCH v3 1/2] block: adapt blk_mq_plug() to not plug for writes that require a zone lock Pankaj Raghav
2022-09-29 8:14 ` Damien Le Moal [this message]
2022-09-29 8:34 ` Johannes Thumshirn
2022-09-29 7:47 ` [PATCH v3 2/2] block: use blk_mq_plug() wrapper consistently in the block layer Pankaj Raghav
2022-09-29 8:15 ` Damien Le Moal
2022-09-29 8:35 ` Johannes Thumshirn
2022-09-29 13:24 ` Jens Axboe
2022-09-29 13:41 ` Pankaj Raghav
2022-09-29 13:45 ` Jens Axboe
2022-09-29 13:48 ` Pankaj Raghav
2022-09-29 13:46 ` (subset) [PATCH v3 0/2] plugging cleanup v3 Jens Axboe
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=c34ce7f3-8bf2-99c0-9c82-ea6691f762ef@opensource.wdc.com \
--to=damien.lemoal@opensource.wdc.com \
--cc=axboe@kernel.dk \
--cc=gost.dev@samsung.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=p.raghav@samsung.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