From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Caleb Sander Mateos <csander@purestorage.com>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
linux-block@vger.kernel.org
Subject: Re: [PATCH 2/2] block: handle REQ_OP_ZONE_APPEND in __bio_integrity_action
Date: Wed, 24 Jun 2026 22:29:14 -0400 [thread overview]
Message-ID: <yq1cxxfpfiw.fsf@ca-mkp.ca.oracle.com> (raw)
In-Reply-To: <CADUfDZrDNT5rVXE_zSn9-MT1YwZvN2ynCSy_zY4xt-jx_SyuTw@mail.gmail.com> (Caleb Sander Mateos's message of "Wed, 24 Jun 2026 08:42:36 -0700")
Caleb,
> Right, I don't mean partitions of zoned devices, but block devices in
> general. I was just trying to understand why the remapping
> infrastructure exists in the first place. Seems like we can't remove
> it entirely, but we can at least ensure the ref tag seeds are correct
> if it's skipped for a non-partitioned device.
The entity attaching the PI to the I/O decides what the seed value
should be.
If you are an application preparing PI, you don't know which LBA a write
is eventually going to end up at. You just know you are writing block 10
inside your file. So you generate PI starting with a reference tag value
of 10 because that is what makes sense to you. And thus you set the seed
to 10 to tell the remapping code which initial reference tag value to
expect in the prepared PI buffer.
Once the write hits the bottom of the stack, we know which initial
reference tag the hardware expects. So we remap the reference tags in
the PI buffer from whatever made sense to the application to whatever
the hardware requires. I.e. an initial value of the lower 32 bits of the
LBA for T10 PI Type 1, incremented by 1 for each subsequent protection
interval.
For reads, it's the same thing. The application wants to read starting
at block offset 10 inside the file so it sets the seed value to 10. At
the bottom of the stack we know how to interpret the PI returned by the
hardware. So we validate that the reference tags received from the
controller match the lower 32 bits of the LBA or whatever the correct PI
format is. And then we remap the reference tags in the received PI
buffer, setting the reference tag to the requested value of 10 for the
first block, and then incrementing by 1 for each subsequent protection
interval.
This allows the application to validate the received reference tags
without ever knowing anything about which start LBA the I/O happened to
come from.
Both DIX and NVMe also allow the hardware to perform the remapping so
the software remapping step can be skipped altogether. Christoph and I
briefly talked about that last week. We currently don't take advantage
of that capability in the NVMe driver.
--
Martin K. Petersen
next prev parent reply other threads:[~2026-06-25 2:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 8:00 PI fixes v2 Christoph Hellwig
2026-06-24 8:00 ` [PATCH 1/2] block: fix GFP_ flags confusion in bio_integrity_alloc_buf Christoph Hellwig
2026-06-24 8:00 ` [PATCH 2/2] block: handle REQ_OP_ZONE_APPEND in __bio_integrity_action Christoph Hellwig
2026-06-24 15:29 ` Caleb Sander Mateos
2026-06-24 15:38 ` Christoph Hellwig
2026-06-24 15:42 ` Caleb Sander Mateos
2026-06-25 2:29 ` Martin K. Petersen [this message]
2026-06-25 4:07 ` Caleb Sander Mateos
2026-06-24 12:26 ` PI fixes v2 Martin K. Petersen
2026-06-24 12:53 ` Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2026-06-23 14:29 PI fixes Christoph Hellwig
2026-06-23 14:29 ` [PATCH 2/2] block: handle REQ_OP_ZONE_APPEND in __bio_integrity_action Christoph Hellwig
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=yq1cxxfpfiw.fsf@ca-mkp.ca.oracle.com \
--to=martin.petersen@oracle.com \
--cc=axboe@kernel.dk \
--cc=csander@purestorage.com \
--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