Skip to content

Commit 4c241d0

Browse files
martinkpetersenaxboe
authored andcommitted
block: Export integrity data interval size in sysfs
The size of the data interval was not exported in the sysfs integrity directory. Export it so that userland apps can tell whether the interval is different from the device's logical block size. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>
1 parent a48f041 commit 4c241d0

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

‎Documentation/ABI/testing/sysfs-block‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ Description:
6060
Indicates whether a storage device is capable of storing
6161
integrity metadata. Set if the device is T10 PI-capable.
6262

63+
What: /sys/block/<disk>/integrity/protection_interval_bytes
64+
Date: July 2015
65+
Contact: Martin K. Petersen <martin.petersen@oracle.com>
66+
Description:
67+
Describes the number of data bytes which are protected
68+
by one integrity tuple. Typically the device's logical
69+
block size.
6370

6471
What: /sys/block/<disk>/integrity/write_generate
6572
Date: June 2008

‎block/blk-integrity.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,14 @@ static ssize_t integrity_tag_size_show(struct blk_integrity *bi, char *page)
289289
return sprintf(page, "0\n");
290290
}
291291

292+
static ssize_t integrity_interval_show(struct blk_integrity *bi, char *page)
293+
{
294+
if (bi != NULL)
295+
return sprintf(page, "%u\n", 1 << bi->interval_exp);
296+
else
297+
return sprintf(page, "0\n");
298+
}
299+
292300
static ssize_t integrity_verify_store(struct blk_integrity *bi,
293301
const char *page, size_t count)
294302
{
@@ -343,6 +351,11 @@ static struct integrity_sysfs_entry integrity_tag_size_entry = {
343351
.show = integrity_tag_size_show,
344352
};
345353

354+
static struct integrity_sysfs_entry integrity_interval_entry = {
355+
.attr = { .name = "protection_interval_bytes", .mode = S_IRUGO },
356+
.show = integrity_interval_show,
357+
};
358+
346359
static struct integrity_sysfs_entry integrity_verify_entry = {
347360
.attr = { .name = "read_verify", .mode = S_IRUGO | S_IWUSR },
348361
.show = integrity_verify_show,
@@ -363,6 +376,7 @@ static struct integrity_sysfs_entry integrity_device_entry = {
363376
static struct attribute *integrity_attrs[] = {
364377
&integrity_format_entry.attr,
365378
&integrity_tag_size_entry.attr,
379+
&integrity_interval_entry.attr,
366380
&integrity_verify_entry.attr,
367381
&integrity_generate_entry.attr,
368382
&integrity_device_entry.attr,

0 commit comments

Comments
 (0)