summaryrefslogtreecommitdiffstats
path: root/block/blk-integrity.c
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2015-10-21 13:19:43 -0400
committerJens Axboe <axboe@fb.com>2015-10-21 14:42:41 -0600
commit4c241d08dbfcbdc7a949b91d72707a289d464954 (patch)
tree8663290b5214c39c0225e871f1791342d95b2c8b /block/blk-integrity.c
parenta48f041d91bf1aee599fa2adb53b780ed20c2ee5 (diff)
downloadlinux-4c241d08dbfcbdc7a949b91d72707a289d464954.tar.gz
linux-4c241d08dbfcbdc7a949b91d72707a289d464954.tar.bz2
linux-4c241d08dbfcbdc7a949b91d72707a289d464954.zip
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>
Diffstat (limited to 'block/blk-integrity.c')
-rw-r--r--block/blk-integrity.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index c7508654faff..7a96f57ed195 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -289,6 +289,14 @@ static ssize_t integrity_tag_size_show(struct blk_integrity *bi, char *page)
return sprintf(page, "0\n");
}
+static ssize_t integrity_interval_show(struct blk_integrity *bi, char *page)
+{
+ if (bi != NULL)
+ return sprintf(page, "%u\n", 1 << bi->interval_exp);
+ else
+ return sprintf(page, "0\n");
+}
+
static ssize_t integrity_verify_store(struct blk_integrity *bi,
const char *page, size_t count)
{
@@ -343,6 +351,11 @@ static struct integrity_sysfs_entry integrity_tag_size_entry = {
.show = integrity_tag_size_show,
};
+static struct integrity_sysfs_entry integrity_interval_entry = {
+ .attr = { .name = "protection_interval_bytes", .mode = S_IRUGO },
+ .show = integrity_interval_show,
+};
+
static struct integrity_sysfs_entry integrity_verify_entry = {
.attr = { .name = "read_verify", .mode = S_IRUGO | S_IWUSR },
.show = integrity_verify_show,
@@ -363,6 +376,7 @@ static struct integrity_sysfs_entry integrity_device_entry = {
static struct attribute *integrity_attrs[] = {
&integrity_format_entry.attr,
&integrity_tag_size_entry.attr,
+ &integrity_interval_entry.attr,
&integrity_verify_entry.attr,
&integrity_generate_entry.attr,
&integrity_device_entry.attr,