public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Milan Broz <gmazyland@gmail.com>
To: linux-block <linux-block@vger.kernel.org>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	Christoph Hellwig <hch@infradead.org>,
	"dm-devel@lists.linux.dev" <dm-devel@lists.linux.dev>
Subject: sysfs integrity fields use
Date: Tue, 25 Feb 2025 10:23:49 +0100	[thread overview]
Message-ID: <67795955-93a4-405b-b0b7-e6b5d921f35e@gmail.com> (raw)

Hi,

I tried to add some support for using devices with PI/DIF metadata
and checked (through sysfs) how large metadata space per sector
is available.

The problem is that some values behave differently than I expected.

For an NVMe drive, reformatted to 4096 + 64 profile, I see this:

- /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."

- /sys/block/<disk>/integrity/format
  Contains expected "nop" (not "none")

- /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.)

Then we have new (undocumented) value for NVMe in
- /sys/block/<nvme>/integrity/metadata_bytes
   This contains the correct 64.

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? :-)

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)?

(This is on recent Linus' master - 6.14.0-rc4)

Thanks,
Milan

             reply	other threads:[~2025-02-25  9:23 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 ` Milan Broz [this message]
2025-02-25 10:10   ` sysfs integrity fields use 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
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=67795955-93a4-405b-b0b7-e6b5d921f35e@gmail.com \
    --to=gmazyland@gmail.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=hch@infradead.org \
    --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