public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Keith Busch <kbusch@meta.com>,
	linux-block@vger.kernel.org, martin.petersen@oracle.com,
	axboe@kernel.dk
Subject: Re: [RFC PATCH] blk-integrity: support arbitrary buffer alignment
Date: Wed, 5 Nov 2025 07:42:41 -0700	[thread overview]
Message-ID: <aQtiYd69E-3G_PC4@kbusch-mbp> (raw)
In-Reply-To: <20251105141504.GC22325@lst.de>

On Wed, Nov 05, 2025 at 03:15:04PM +0100, Christoph Hellwig wrote:
> I have a hard time understanding how this actually works, mostly due to
> "union pi_tuple".  What does that union of two pointers buy us over just
> passing a void pointer and deriving the type we need deeper down?  Also
> given that taking the address and the comparing it (at thbeginning of
> blk_tuple_remap_end) how is this actually going to work?

It's a good question.

This generally does pass 'void *' to contiguous protection data. If the
actual protection payload is spread across multiple segments, though, we
don't have contiguous data, so we have to bounce it through something.
Declaring the union on the stack provides this memory for that unusual
case. If the bip segment is big enough, we point the 'void *' directly
at it; if not, we point it to the temporary onstack allocation. Using
a union ensures that it's definitely big enough for any checksum type.

Again, it's a weird corner case. The kernel auto-pi wouldn't allocate
that way unless you have very weird metadata format, like with an odd
number of bytes preceding or following the DIF (never encountered such a
thing, but the specs allow it). User space can send weird alignemnts
with io_uring now, too.

  reply	other threads:[~2025-11-05 14:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04 22:40 [RFC PATCH] blk-integrity: support arbitrary buffer alignment Keith Busch
2025-11-05 14:15 ` Christoph Hellwig
2025-11-05 14:42   ` Keith Busch [this message]
2025-11-05 14:51     ` Keith Busch
2025-11-05 14:53     ` Christoph Hellwig
2025-11-05 16:28       ` Keith Busch

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=aQtiYd69E-3G_PC4@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=kbusch@meta.com \
    --cc=linux-block@vger.kernel.org \
    --cc=martin.petersen@oracle.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