On 2/25/25 11:10 AM, Kanchan Joshi wrote:
On 2/25/2025 2:53 PM, Milan Broz wrote:
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 (?)
This and "nop" indicates that pi-type was configured to be 0?
Maybe you can share the nvme format command as well.
Sure, it is formatted to 4k data + 64 bytes metadata profile:
# nvme id-ns -H /dev/nvme0n1
...
LBA Format 0 : Metadata Size: 0 bytes - Data Size: 512 bytes - Relative Performance: 0 Best
LBA Format 1 : Metadata Size: 8 bytes - Data Size: 512 bytes - Relative Performance: 0 Best
LBA Format 2 : Metadata Size: 0 bytes - Data Size: 4096 bytes - Relative Performance: 0 Best
LBA Format 3 : Metadata Size: 64 bytes - Data Size: 4096 bytes - Relative Performance: 0 Best (in use)
formatted with
# nvme format --lbaf=3 --force /dev/nvme0n1
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.
Maybe you mean "/sys/block/>/metadata_bytes"?
Yes, it is not under integrity subdir, just copy& paste error, sorry.
Just to add - I would like to add these integrity fields also to lsblk, but there we need exact
specification where to get integrity info.
Milan