From: Christoph Hellwig <hch@infradead.org>
To: Milan Broz <gmazyland@gmail.com>
Cc: linux-block <linux-block@vger.kernel.org>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Christoph Hellwig <hch@infradead.org>,
"dm-devel@lists.linux.dev" <dm-devel@lists.linux.dev>
Subject: Re: sysfs integrity fields use
Date: Tue, 25 Feb 2025 07:38:53 -0800 [thread overview]
Message-ID: <Z73kDfIkgu4v-c9W@infradead.org> (raw)
In-Reply-To: <67795955-93a4-405b-b0b7-e6b5d921f35e@gmail.com>
On Tue, Feb 25, 2025 at 10:23:49AM +0100, Milan Broz wrote:
> Hi,
>
> I tried to add some support for using devices with PI/DIF metadata
> For an NVMe drive, reformatted to 4096 + 64 profile, I see this:
Based on everything below you have no formatted it with PI and you
also don't plan to use PI, just plain non-integrity metadata.
>
> - /sys/block/<disk>/integrity/device_is_integrity_capable
> Contains 0 (?)
> According to docs, this field
> "Indicates whether a storage device is capable of storing integrity metadata.
> Set if the device is T10 PI-capable."
this is only 1 if protection information is enabled, and 0
for non-PI metadata.
> - /sys/block/<disk>/integrity/tag_size
> Contains 0 (?)
> According to docs, this is "Number of bytes of integrity tag space
> available per 512 bytes of data."
> (I think 512 bytes is incorrect; it should be sector size, or perhaps
> value in protection_interval_bytes, though.)
Yes, it should be an integrity interval. Which for all current drivers
is the LBA size. And the tag_size is the size of the PI metadata, so
0 is expected.
> Then we have new (undocumented) value for NVMe in
> - /sys/block/<nvme>/integrity/metadata_bytes
> This contains the correct 64.
Yes, this contains the full size of the metadata. And besides
documenting it we should probably also lift it to the block layer.
> Anyway, when I try to use it (for authentication tags in dm-crypt), it works.
>
> Should tag_size and device_is_integrity_capable be set even for the "nop" format?
> Is it a bug or a feature? :-)
It is expected. The only issue is that the block support for metadata
is called integrity all over because it was initially added for PI only
and then extended for non-PI metadata, which makes things a little
confusing.
> If not, what is the correct way to read per-sector metadata size (not only for NVMe
> as metadata_bytes is not available for other block devices)?
Right now the nvme specific attribute is the only way.
next prev parent reply other threads:[~2025-02-25 15:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250225092525epcas5p31dd0a19ffdfb39f3f2ce4acd1c6da7ee@epcas5p3.samsung.com>
2025-02-25 9:23 ` sysfs integrity fields use Milan Broz
2025-02-25 10:10 ` Kanchan Joshi
2025-02-25 10:44 ` Kanchan Joshi
2025-02-25 11:03 ` Milan Broz
2025-02-26 10:04 ` Kanchan Joshi
2025-02-25 15:38 ` Christoph Hellwig [this message]
2025-02-26 14:02 ` Milan Broz
2025-02-27 14:46 ` [PATCH] docs: sysfs-block: Clarify integrity sysfs attributes for non-PI metadata Milan Broz
2025-03-03 17:25 ` Martin K. Petersen
2025-03-03 18:52 ` Milan Broz
2025-03-06 2:28 ` Martin K. Petersen
2025-03-18 15:44 ` [PATCH] docs: sysfs-block: Clarify integrity sysfs attributes Milan Broz
2025-03-20 7:04 ` Christoph Hellwig
2025-03-20 11:44 ` 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=Z73kDfIkgu4v-c9W@infradead.org \
--to=hch@infradead.org \
--cc=dm-devel@lists.linux.dev \
--cc=gmazyland@gmail.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