aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2014-09-26 19:20:03 -0400
committerJens Axboe <axboe@fb.com>2014-09-27 11:14:51 -0400
commit3aec2f41a8baeb70aa77556a4e4dcec7d9d70b4d (patch)
tree2725a81cae556798bd3f363c4e8e5595c1ce1aaf /block
parent8288f496eb1b1905c425e92eaf1abbb29119217b (diff)
block: Add a disk flag to block integrity profile
So far we have relied on the app tag size to determine whether a disk has been formatted with T10 protection information or not. However, not all target devices provide application tag storage. Add a flag to the block integrity profile that indicates whether the disk has been formatted with protection information. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Sagi Grimberg <sagig@dev.mellanox.co.il> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-integrity.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index a7436ccc936b..1c6ba442cd91 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -307,6 +307,12 @@ static ssize_t integrity_generate_show(struct blk_integrity *bi, char *page)
307 return sprintf(page, "%d\n", (bi->flags & BLK_INTEGRITY_GENERATE) != 0); 307 return sprintf(page, "%d\n", (bi->flags & BLK_INTEGRITY_GENERATE) != 0);
308} 308}
309 309
310static ssize_t integrity_device_show(struct blk_integrity *bi, char *page)
311{
312 return sprintf(page, "%u\n",
313 (bi->flags & BLK_INTEGRITY_DEVICE_CAPABLE) != 0);
314}
315
310static struct integrity_sysfs_entry integrity_format_entry = { 316static struct integrity_sysfs_entry integrity_format_entry = {
311 .attr = { .name = "format", .mode = S_IRUGO }, 317 .attr = { .name = "format", .mode = S_IRUGO },
312 .show = integrity_format_show, 318 .show = integrity_format_show,
@@ -329,11 +335,17 @@ static struct integrity_sysfs_entry integrity_generate_entry = {
329 .store = integrity_generate_store, 335 .store = integrity_generate_store,
330}; 336};
331 337
338static struct integrity_sysfs_entry integrity_device_entry = {
339 .attr = { .name = "device_is_integrity_capable", .mode = S_IRUGO },
340 .show = integrity_device_show,
341};
342
332static struct attribute *integrity_attrs[] = { 343static struct attribute *integrity_attrs[] = {
333 &integrity_format_entry.attr, 344 &integrity_format_entry.attr,
334 &integrity_tag_size_entry.attr, 345 &integrity_tag_size_entry.attr,
335 &integrity_verify_entry.attr, 346 &integrity_verify_entry.attr,
336 &integrity_generate_entry.attr, 347 &integrity_generate_entry.attr,
348 &integrity_device_entry.attr,
337 NULL, 349 NULL,
338}; 350};
339 351