All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
To: Damien Le Moal <dlemoal@kernel.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	Jens Axboe <axboe@kernel.dk>,
	"dm-devel@lists.linux.dev" <dm-devel@lists.linux.dev>,
	Mike Snitzer <snitzer@kernel.org>,
	Mikulas Patocka <mpatocka@redhat.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Subject: Re: [PATCH v3 2/5] block: Introduce bio_needs_zone_write_plugging()
Date: Wed, 25 Jun 2025 11:47:37 +0000	[thread overview]
Message-ID: <c57877ca-40e1-4f57-96d7-dfa2a4e8aef9@wdc.com> (raw)
In-Reply-To: <20250625093327.548866-3-dlemoal@kernel.org>

On 25.06.25 11:44, Damien Le Moal wrote:
> static inline bool bio_needs_zone_write_plugging(struct bio *bio)
> +{
> +	enum req_op op = bio_op(bio);
> +
> +	/*
> +	 * Only zoned block devices have a zone write plug hash table. But not
> +	 * all of them have one (e.g. DM devices may not need one).
> +	 */
> +	if (!bio->bi_bdev->bd_disk->zone_wplugs_hash)
> +		return false;
> +
> +	/* Only write operations need zone write plugging. */
> +	if (!op_is_write(op))
> +		return false;
> +
> +	/* Ignore empty flush */
> +	if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))
> +		return false;
> +
> +	/* Ignore BIOs that already have been handled by zone write plugging. */
> +	if (bio_flagged(bio, BIO_ZONE_WRITE_PLUGGING))
> +		return false;
> +
> +	/*
> +	 * All zone write operations must be handled through zone write plugging
> +	 * using blk_zone_plug_bio().
> +	 */
> +	switch (op) {
> +	case REQ_OP_ZONE_APPEND:
> +	case REQ_OP_WRITE:
> +	case REQ_OP_WRITE_ZEROES:
> +	case REQ_OP_ZONE_FINISH:
> +	case REQ_OP_ZONE_RESET:
> +	case REQ_OP_ZONE_RESET_ALL:
> +		return true;
> +	default:
> +		return false;
> +	}

Maybe this is bikeshedding territory here but I'd move the long pointer 
chase 'bio->bi_bdev->bd_disk->zone_wplugs_hash' later into the function.
At least after the op_is_write() check, so that reads don't get the 
pointer chase.

  parent reply	other threads:[~2025-06-25 11:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-25  9:33 [PATCH v3 0/5] Fix write operation handling for zoned DM devices Damien Le Moal
2025-06-25  9:33 ` [PATCH v3 1/5] block: Make REQ_OP_ZONE_FINISH a write operation Damien Le Moal
2025-06-25 11:28   ` Christoph Hellwig
2025-06-25 11:42   ` Johannes Thumshirn
2025-06-25 15:44   ` Bart Van Assche
2025-06-25 16:29   ` Bart Van Assche
2025-06-25 23:36     ` Damien Le Moal
2025-06-26 20:29       ` Bart Van Assche
2025-06-25  9:33 ` [PATCH v3 2/5] block: Introduce bio_needs_zone_write_plugging() Damien Le Moal
2025-06-25 11:28   ` Christoph Hellwig
2025-06-25 11:47   ` Johannes Thumshirn [this message]
2025-06-25 15:48   ` Bart Van Assche
2025-06-25 23:38     ` Damien Le Moal
2025-06-26 16:37       ` Bart Van Assche
2025-06-25  9:33 ` [PATCH v3 3/5] dm: Always split write BIOs to zoned device limits Damien Le Moal
2025-06-25 11:49   ` Johannes Thumshirn
2025-06-25 16:30   ` Mikulas Patocka
2025-06-25 16:34   ` Bart Van Assche
2025-06-25 23:41     ` Damien Le Moal
2025-06-25  9:33 ` [PATCH v3 4/5] dm: dm-crypt: Do not partially accept write BIOs with zoned targets Damien Le Moal
2025-06-25 16:31   ` Mikulas Patocka
2025-06-25 16:42   ` Bart Van Assche
2025-06-25  9:33 ` [PATCH v3 5/5] dm: Check for forbidden splitting of zone write operations Damien Le Moal
2025-06-25 16:31   ` Mikulas Patocka
2025-06-25 16:37 ` [PATCH v3 0/5] Fix write operation handling for zoned DM devices 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=c57877ca-40e1-4f57-96d7-dfa2a4e8aef9@wdc.com \
    --to=johannes.thumshirn@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=dlemoal@kernel.org \
    --cc=dm-devel@lists.linux.dev \
    --cc=linux-block@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@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.