From: Damien Le Moal <dlemoal@kernel.org>
To: Bart Van Assche <bvanassche@acm.org>, Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org,
Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v21 06/12] blk-zoned: Introduce a loop in blk_zone_wplug_bio_work()
Date: Fri, 18 Jul 2025 16:17:10 +0900 [thread overview]
Message-ID: <d53b460c-5347-41ed-a60d-0b7cf4e71024@kernel.org> (raw)
In-Reply-To: <20250717205808.3292926-7-bvanassche@acm.org>
On 7/18/25 05:58, Bart Van Assche wrote:
> Prepare for submitting multiple bios from inside a single
> blk_zone_wplug_bio_work() call. No functionality has been changed.
>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> block/blk-zoned.c | 72 +++++++++++++++++++++++------------------------
> 1 file changed, 36 insertions(+), 36 deletions(-)
>
> diff --git a/block/blk-zoned.c b/block/blk-zoned.c
> index 8fe6e545f300..6ef53f78fa3b 100644
> --- a/block/blk-zoned.c
> +++ b/block/blk-zoned.c
> @@ -1283,47 +1283,47 @@ static void blk_zone_wplug_bio_work(struct work_struct *work)
> struct blk_zone_wplug *zwplug =
> container_of(work, struct blk_zone_wplug, bio_work);
> struct block_device *bdev;
> - unsigned long flags;
> struct bio *bio;
>
> - /*
> - * Submit the next plugged BIO. If we do not have any, clear
> - * the plugged flag.
> - */
> - spin_lock_irqsave(&zwplug->lock, flags);
> -
> + do {
> again:
> - bio = bio_list_pop(&zwplug->bio_list);
> - if (!bio) {
> - zwplug->flags &= ~BLK_ZONE_WPLUG_PLUGGED;
> - spin_unlock_irqrestore(&zwplug->lock, flags);
> - goto put_zwplug;
> - }
> -
> - trace_blk_zone_wplug_bio(zwplug->disk->queue, zwplug->zone_no,
> - bio->bi_iter.bi_sector, bio_sectors(bio));
> -
> - if (!blk_zone_wplug_prepare_bio(zwplug, bio)) {
> - blk_zone_wplug_bio_io_error(zwplug, bio);
> - goto again;
> - }
> -
> - spin_unlock_irqrestore(&zwplug->lock, flags);
> + /*
> + * Submit the next plugged BIO. If we do not have any, clear
> + * the plugged flag.
> + */
> + scoped_guard(spinlock_irqsave, &zwplug->lock) {
I am really not a fan of this. It adds one level of indentation without making
the code easier to read.
> + bio = bio_list_pop(&zwplug->bio_list);
> + if (!bio) {
> + zwplug->flags &= ~BLK_ZONE_WPLUG_PLUGGED;
> + goto put_zwplug;
> + }
> +
> + trace_blk_zone_wplug_bio(zwplug->disk->queue,
> + zwplug->zone_no,
> + bio->bi_iter.bi_sector,
> + bio_sectors(bio));
> +
> + if (!blk_zone_wplug_prepare_bio(zwplug, bio)) {
> + blk_zone_wplug_bio_io_error(zwplug, bio);
> + goto again;
> + }
> + }
>
> - bdev = bio->bi_bdev;
> + bdev = bio->bi_bdev;
>
> - /*
> - * blk-mq devices will reuse the extra reference on the request queue
> - * usage counter we took when the BIO was plugged, but the submission
> - * path for BIO-based devices will not do that. So drop this extra
> - * reference here.
> - */
> - if (bdev_test_flag(bdev, BD_HAS_SUBMIT_BIO)) {
> - bdev->bd_disk->fops->submit_bio(bio);
> - blk_queue_exit(bdev->bd_disk->queue);
> - } else {
> - blk_mq_submit_bio(bio);
> - }
> + /*
> + * blk-mq devices will reuse the extra reference on the request
> + * queue usage counter we took when the BIO was plugged, but the
> + * submission path for BIO-based devices will not do that. So
> + * drop this extra reference here.
> + */
> + if (bdev_test_flag(bdev, BD_HAS_SUBMIT_BIO)) {
> + bdev->bd_disk->fops->submit_bio(bio);
> + blk_queue_exit(bdev->bd_disk->queue);
> + } else {
> + blk_mq_submit_bio(bio);
> + }
> + } while (0);
>
> put_zwplug:
> /* Drop the reference we took in disk_zone_wplug_schedule_bio_work(). */
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2025-07-18 7:17 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-17 20:57 [PATCH v21 00/12] Improve write performance for zoned UFS devices Bart Van Assche
2025-07-17 20:57 ` [PATCH v21 01/12] block: Support block devices that preserve the order of write requests Bart Van Assche
2025-07-17 20:57 ` [PATCH v21 02/12] blk-mq: Restore the zone write order when requeuing Bart Van Assche
2025-07-17 20:57 ` [PATCH v21 03/12] blk-zoned: Add an argument to blk_zone_plug_bio() Bart Van Assche
2025-07-18 7:13 ` Damien Le Moal
2025-07-18 15:54 ` Bart Van Assche
2025-07-17 20:58 ` [PATCH v21 04/12] blk-zoned: Split an if-statement Bart Van Assche
2025-07-17 20:58 ` [PATCH v21 05/12] blk-zoned: Move code from disk_zone_wplug_add_bio() into its caller Bart Van Assche
2025-07-18 7:15 ` Damien Le Moal
2025-07-17 20:58 ` [PATCH v21 06/12] blk-zoned: Introduce a loop in blk_zone_wplug_bio_work() Bart Van Assche
2025-07-18 7:17 ` Damien Le Moal [this message]
2025-07-17 20:58 ` [PATCH v21 07/12] blk-zoned: Support pipelining of zoned writes Bart Van Assche
2025-07-18 7:38 ` Damien Le Moal
2025-07-18 16:29 ` Bart Van Assche
2025-07-17 20:58 ` [PATCH v21 08/12] scsi: core: Retry unaligned " Bart Van Assche
2025-07-17 20:58 ` [PATCH v21 09/12] scsi: sd: Increase retry count for " Bart Van Assche
2025-07-17 20:58 ` [PATCH v21 10/12] scsi: scsi_debug: Add the preserves_write_order module parameter Bart Van Assche
2025-07-17 20:58 ` [PATCH v21 11/12] scsi: scsi_debug: Support injecting unaligned write errors Bart Van Assche
2025-07-17 20:58 ` [PATCH v21 12/12] ufs: core: Inform the block layer about write ordering Bart Van Assche
2025-07-18 7:08 ` [PATCH v21 00/12] Improve write performance for zoned UFS devices Damien Le Moal
2025-07-18 18:30 ` Bart Van Assche
2025-07-22 1:36 ` Damien Le Moal
2025-07-22 18:24 ` Bart Van Assche
2025-07-18 7:39 ` Damien Le Moal
2025-07-18 16:32 ` 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=d53b460c-5347-41ed-a60d-0b7cf4e71024@kernel.org \
--to=dlemoal@kernel.org \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@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.