public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Milan Broz <gmazyland@gmail.com>
To: Kanchan Joshi <joshi.k@samsung.com>,
	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: Re: sysfs integrity fields use
Date: Tue, 25 Feb 2025 12:03:02 +0100	[thread overview]
Message-ID: <ba3840dd-e3a7-4896-89c9-0f131bb46fa5@gmail.com> (raw)
In-Reply-To: <823d3261-671d-41cb-ab15-10a361c48bca@samsung.com>

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


  parent reply	other threads:[~2025-02-25 11:03 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 [this message]
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=ba3840dd-e3a7-4896-89c9-0f131bb46fa5@gmail.com \
    --to=gmazyland@gmail.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=hch@infradead.org \
    --cc=joshi.k@samsung.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