History

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.

Martin K. Petersen committed 12 years ago

Commit 3aec2f41 parent 8288f494 files · +28 −1Browse files

Unified · Split

4 files
  1. Documentation/ABI/testing/sysfs-block +8 −0
  2. block/blk-integrity.c +12 −0
  3. drivers/scsi/sd_dif.c +7 −1
  4. include/linux/blkdev.h +1 −0
Documentation/ABI/testing/sysfs-block+8−0
@@ -53,6 +53,14 @@ Description: · 52 unmodified lines
53 512 bytes of data.53 512 bytes of data.
54 54
55 55
56What: /sys/block/<disk>/integrity/device_is_integrity_capable
57Date: July 2014
58Contact: Martin K. Petersen <martin.petersen@oracle.com>
59Description:
60 Indicates whether a storage device is capable of storing
61 integrity metadata. Set if the device is T10 PI-capable.
62
63
56What: /sys/block/<disk>/integrity/write_generate64What: /sys/block/<disk>/integrity/write_generate
57Date: June 200865Date: June 2008
58Contact: Martin K. Petersen <martin.petersen@oracle.com>66Contact: Martin K. Petersen <martin.petersen@oracle.com>
block/blk-integrity.c+12−0
@@ -307,6 +307,12 @@ static ssize_t integrity_generate_show(struct blk_integrity *bi, char *page) · 306 unmodified lines
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 = { · 16 unmodified lines
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
drivers/scsi/sd_dif.c+7−1
@@ -270,7 +270,13 @@ void sd_dif_config_host(struct scsi_disk *sdkp) · 269 unmodified lines
270 "Enabling DIX %s protection\n", disk->integrity->name);270 "Enabling DIX %s protection\n", disk->integrity->name);
271 271
272 /* Signal to block layer that we support sector tagging */272 /* Signal to block layer that we support sector tagging */
273 if (dif && type && sdkp->ATO) {273 if (dif && type) {
274
275 disk->integrity->flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
276
277 if (!sdkp)
278 return;
279
274 if (type == SD_DIF_TYPE3_PROTECTION)280 if (type == SD_DIF_TYPE3_PROTECTION)
275 disk->integrity->tag_size = sizeof(u16) + sizeof(u32);281 disk->integrity->tag_size = sizeof(u16) + sizeof(u32);
276 else282 else
include/linux/blkdev.h+1−0
@@ -1461,6 +1461,7 @@ static inline uint64_t rq_io_start_time_ns(struct request *req) · 1460 unmodified lines
1461enum blk_integrity_flags {1461enum blk_integrity_flags {
1462 BLK_INTEGRITY_VERIFY = 1 << 0,1462 BLK_INTEGRITY_VERIFY = 1 << 0,
1463 BLK_INTEGRITY_GENERATE = 1 << 1,1463 BLK_INTEGRITY_GENERATE = 1 << 1,
1464 BLK_INTEGRITY_DEVICE_CAPABLE = 1 << 2,
1464};1465};
1465 1466
1466struct blk_integrity_iter {1467struct blk_integrity_iter {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t