Re: [PATCH 08/14] block: Add a disk flag to block integrity profile

2014-07-03 Thread Sagi Grimberg

On 6/25/2014 2:49 PM, Martin K. Petersen wrote:

"Christoph" == Christoph Hellwig  writes:

Christoph> On Wed, Jun 11, 2014 at 09:30:34PM -0400, Martin K. Petersen wrote:

/sys/block/foo/integrity/disk_is_formatted_with_pi
/sys/block/foo/integrity/disk_is_integrity_capable
/sys/block/foo/integrity/disk_supports_storing_pi

Or would you prefer something other than disk? target?
storage_device?

Christoph> I'd defintively prefer the target_ prefix and one of the
Christoph> descriptive suffixes.

OK, will tweak.



But this entry doesn't refer to a target, it refers to a backend device.
IMO disk_ or device_ or storage_device prefixes would be better...

Sagi.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/14] block: Add a disk flag to block integrity profile

2014-06-25 Thread Martin K. Petersen
> "Christoph" == Christoph Hellwig  writes:

Christoph> On Wed, Jun 11, 2014 at 09:30:34PM -0400, Martin K. Petersen wrote:
>> /sys/block/foo/integrity/disk_is_formatted_with_pi
>> /sys/block/foo/integrity/disk_is_integrity_capable
>> /sys/block/foo/integrity/disk_supports_storing_pi
>> 
>> Or would you prefer something other than disk? target?
>> storage_device?

Christoph> I'd defintively prefer the target_ prefix and one of the
Christoph> descriptive suffixes.

OK, will tweak.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/14] block: Add a disk flag to block integrity profile

2014-06-25 Thread Christoph Hellwig
On Wed, Jun 11, 2014 at 09:30:34PM -0400, Martin K. Petersen wrote:
> /sys/block/foo/integrity/disk_is_formatted_with_pi
> /sys/block/foo/integrity/disk_is_integrity_capable
> /sys/block/foo/integrity/disk_supports_storing_pi
> 
> Or would you prefer something other than disk? target? storage_device?

I'd defintively prefer the target_ prefix and one of the descriptive
suffixes.

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/14] block: Add a disk flag to block integrity profile

2014-06-11 Thread Martin K. Petersen
> "Christoph" == Christoph Hellwig  writes:

Hey Christoph,

>> Add a flag to the block integrity profile that indicates whether the
>> disk has been formatted with protection information.

Christoph> I'm totally confused on why the sysfs file and flag are named
Christoph> 'disk'.  What does it stand for given that we already have a
Christoph> very established use of the term 'disk' in block I/O land..

The flag indicates whether or not the disk itself is integrity capable.
I.e. whether the protection extends beyond the HBA or not.

I'm open to suggestions for a better name. When I originally did this I
found it hard to come up with something that didn't sound convoluted or
redundant. The file resides in /sys/block/foo/integrity/ and I guess I
found "disk" sufficient given the context.

/sys/block/foo/integrity/disk_is_formatted_with_pi
/sys/block/foo/integrity/disk_is_integrity_capable
/sys/block/foo/integrity/disk_supports_storing_pi

Or would you prefer something other than disk? target? storage_device?

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/14] block: Add a disk flag to block integrity profile

2014-06-11 Thread Christoph Hellwig
On Wed, May 28, 2014 at 11:28:42PM -0400, Martin K. Petersen wrote:
> 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.

I'm totally confused on why the sysfs file and flag are named 'disk'.
What does it stand for given that we already have a very established
use of the term 'disk' in block I/O land..

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/14] block: Add a disk flag to block integrity profile

2014-05-28 Thread Martin K. Petersen
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 
---
 Documentation/ABI/testing/sysfs-block |  9 +
 block/blk-integrity.c | 11 +++
 drivers/scsi/sd_dif.c |  8 +++-
 include/linux/blkdev.h|  1 +
 4 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/Documentation/ABI/testing/sysfs-block 
b/Documentation/ABI/testing/sysfs-block
index 279da08f7541..5876e163c430 100644
--- a/Documentation/ABI/testing/sysfs-block
+++ b/Documentation/ABI/testing/sysfs-block
@@ -53,6 +53,15 @@ Description:
512 bytes of data.
 
 
+What:  /sys/block//integrity/disk
+Date:  February 2011
+Contact:   Martin K. Petersen 
+Description:
+   Indicates whether a storage device is capable of
+   persistently storing integrity metadata. Set if the
+   device is T10 PI-capable.
+
+
 What:  /sys/block//integrity/write_generate
 Date:  June 2008
 Contact:   Martin K. Petersen 
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index 95f451a3c581..8cf87655152b 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -307,6 +307,11 @@ static ssize_t integrity_generate_show(struct 
blk_integrity *bi, char *page)
return sprintf(page, "%d\n", (bi->flags & BLK_INTEGRITY_GENERATE) != 0);
 }
 
+static ssize_t integrity_disk_show(struct blk_integrity *bi, char *page)
+{
+   return sprintf(page, "%u\n", (bi->flags & BLK_INTEGRITY_DISK) != 0);
+}
+
 static struct integrity_sysfs_entry integrity_format_entry = {
.attr = { .name = "format", .mode = S_IRUGO },
.show = integrity_format_show,
@@ -329,11 +334,17 @@ static struct integrity_sysfs_entry 
integrity_generate_entry = {
.store = integrity_generate_store,
 };
 
+static struct integrity_sysfs_entry integrity_disk_entry = {
+   .attr = { .name = "disk", .mode = S_IRUGO },
+   .show = integrity_disk_show,
+};
+
 static struct attribute *integrity_attrs[] = {
&integrity_format_entry.attr,
&integrity_tag_size_entry.attr,
&integrity_verify_entry.attr,
&integrity_generate_entry.attr,
+   &integrity_disk_entry.attr,
NULL,
 };
 
diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c
index 801c41851a01..1d401f864fbe 100644
--- a/drivers/scsi/sd_dif.c
+++ b/drivers/scsi/sd_dif.c
@@ -270,7 +270,13 @@ void sd_dif_config_host(struct scsi_disk *sdkp)
  "Enabling DIX %s protection\n", disk->integrity->name);
 
/* Signal to block layer that we support sector tagging */
-   if (dif && type && sdkp->ATO) {
+   if (dif && type) {
+
+   disk->integrity->flags |= BLK_INTEGRITY_DISK;
+
+   if (!sdkp)
+   return;
+
if (type == SD_DIF_TYPE3_PROTECTION)
disk->integrity->tag_size = sizeof(u16) + sizeof(u32);
else
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index bb44630d27f8..4be0446a8817 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1431,6 +1431,7 @@ static inline uint64_t rq_io_start_time_ns(struct request 
*req)
 enum blk_integrity_flags {
BLK_INTEGRITY_VERIFY= 1 << 0,
BLK_INTEGRITY_GENERATE  = 1 << 1,
+   BLK_INTEGRITY_DISK  = 1 << 2,
 };
 
 struct blk_integrity_iter {
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html