From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: axboe@fb.com, nab@daterainc.com, sagig@dev.mellanox.co.il,
linux-scsi@vger.kernel.org
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Subject: [PATCH 10/14] block: Integrity checksum flag
Date: Wed, 28 May 2014 23:28:44 -0400 [thread overview]
Message-ID: <1401334128-15499-11-git-send-email-martin.petersen@oracle.com> (raw)
In-Reply-To: <1401334128-15499-1-git-send-email-martin.petersen@oracle.com>
Make the choice of checksum a per-I/O property by introducing a flag
that can be inspected by the SCSI layer.
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
---
block/bio-integrity.c | 3 +++
drivers/scsi/sd_dif.c | 6 ++++--
include/linux/bio.h | 1 +
include/linux/blkdev.h | 1 +
4 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 877bce028766..4eb7893a7559 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -303,6 +303,9 @@ int bio_integrity_prep(struct bio *bio)
bip->bip_iter.bi_size = len;
bip_set_seed(bip, bio->bi_iter.bi_sector);
+ if (bi->flags & BLK_INTEGRITY_IP_CHECKSUM)
+ bip_set_flag(bip, BIP_IP_CHECKSUM);
+
/* Map it */
offset = offset_in_page(buf);
for (i = 0 ; i < nr_pages ; i++) {
diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c
index 95d5cb806f58..033d30d37952 100644
--- a/drivers/scsi/sd_dif.c
+++ b/drivers/scsi/sd_dif.c
@@ -255,12 +255,14 @@ void sd_dif_config_host(struct scsi_disk *sdkp)
return;
/* Enable DMA of protection information */
- if (scsi_host_get_guard(sdkp->device->host) & SHOST_DIX_GUARD_IP)
+ if (scsi_host_get_guard(sdkp->device->host) & SHOST_DIX_GUARD_IP) {
if (type == SD_DIF_TYPE3_PROTECTION)
blk_integrity_register(disk, &dif_type3_integrity_ip);
else
blk_integrity_register(disk, &dif_type1_integrity_ip);
- else
+
+ disk->integrity->flags |= BLK_INTEGRITY_IP_CHECKSUM;
+ } else
if (type == SD_DIF_TYPE3_PROTECTION)
blk_integrity_register(disk, &dif_type3_integrity_crc);
else
diff --git a/include/linux/bio.h b/include/linux/bio.h
index adc806325c36..83e4725f6aca 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -309,6 +309,7 @@ enum bip_flags {
BIP_MAPPED_INTEGRITY, /* integrity metadata has been remapped */
BIP_CTRL_NOCHECK, /* disable controller integrity checking */
BIP_DISK_NOCHECK, /* disable disk integrity checking */
+ BIP_IP_CHECKSUM, /* IP checksum */
};
static inline bool bip_get_flag(struct bio_integrity_payload *bip,
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 4be0446a8817..9bf6f761f1ac 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1432,6 +1432,7 @@ enum blk_integrity_flags {
BLK_INTEGRITY_VERIFY = 1 << 0,
BLK_INTEGRITY_GENERATE = 1 << 1,
BLK_INTEGRITY_DISK = 1 << 2,
+ BLK_INTEGRITY_IP_CHECKSUM = 1 << 3,
};
struct blk_integrity_iter {
--
1.9.0
next prev parent reply other threads:[~2014-05-29 3:29 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-29 3:28 Data integrity update Martin K. Petersen
2014-05-29 3:28 ` [PATCH 01/14] block: Get rid of bdev_integrity_enabled() Martin K. Petersen
2014-06-11 16:31 ` Christoph Hellwig
2014-07-03 9:18 ` Sagi Grimberg
2014-05-29 3:28 ` [PATCH 02/14] block: Replace bi_integrity with bi_special Martin K. Petersen
2014-06-11 16:32 ` Christoph Hellwig
2014-06-12 0:18 ` Martin K. Petersen
2014-07-03 9:19 ` Sagi Grimberg
2014-05-29 3:28 ` [PATCH 03/14] block: Deprecate integrity tagging functions Martin K. Petersen
2014-06-11 16:33 ` Christoph Hellwig
2014-06-12 0:18 ` Martin K. Petersen
2014-05-29 3:28 ` [PATCH 04/14] block: Remove bip_buf Martin K. Petersen
2014-06-11 16:35 ` Christoph Hellwig
2014-07-03 9:21 ` Sagi Grimberg
2014-05-29 3:28 ` [PATCH 05/14] block: Deprecate the use of the term sector in the context of block integrity Martin K. Petersen
2014-06-11 16:45 ` Christoph Hellwig
2014-06-12 0:26 ` Martin K. Petersen
2014-07-03 9:35 ` Sagi Grimberg
2014-07-03 10:19 ` Sagi Grimberg
2014-05-29 3:28 ` [PATCH 06/14] block: Clean up the code used to generate and verify integrity metadata Martin K. Petersen
2014-07-03 9:40 ` Sagi Grimberg
2014-05-29 3:28 ` [PATCH 07/14] block: Add prefix to block integrity profile flags Martin K. Petersen
2014-06-11 16:46 ` Christoph Hellwig
2014-07-03 9:42 ` Sagi Grimberg
2014-05-29 3:28 ` [PATCH 08/14] block: Add a disk flag to block integrity profile Martin K. Petersen
2014-06-11 16:48 ` Christoph Hellwig
2014-06-12 1:30 ` Martin K. Petersen
2014-06-25 10:24 ` Christoph Hellwig
2014-06-25 11:49 ` Martin K. Petersen
2014-07-03 9:58 ` Sagi Grimberg
2014-05-29 3:28 ` [PATCH 09/14] block: Relocate integrity flags Martin K. Petersen
2014-06-11 16:51 ` Christoph Hellwig
2014-06-12 1:51 ` Martin K. Petersen
2014-07-03 10:03 ` Sagi Grimberg
2014-05-29 3:28 ` Martin K. Petersen [this message]
2014-06-11 16:52 ` [PATCH 10/14] block: Integrity checksum flag Christoph Hellwig
2014-06-12 2:03 ` Martin K. Petersen
2014-05-29 3:28 ` [PATCH 11/14] block: Don't merge requests if integrity flags differ Martin K. Petersen
2014-06-11 16:53 ` Christoph Hellwig
2014-07-03 10:06 ` Sagi Grimberg
2014-05-29 3:28 ` [PATCH 12/14] block: Add specific data integrity errors Martin K. Petersen
2014-06-11 16:54 ` Christoph Hellwig
[not found] ` <20140611165455.GG9511-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2014-06-12 2:16 ` Martin K. Petersen
2014-05-29 3:28 ` [PATCH 13/14] lib: Add T10 Protection Information functions Martin K. Petersen
2014-06-11 16:56 ` Christoph Hellwig
2014-06-12 2:23 ` Martin K. Petersen
2014-05-29 3:28 ` [PATCH 14/14] sd: Honor block layer integrity handling flags Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1401334128-15499-11-git-send-email-martin.petersen@oracle.com \
--to=martin.petersen@oracle.com \
--cc=axboe@fb.com \
--cc=linux-scsi@vger.kernel.org \
--cc=nab@daterainc.com \
--cc=sagig@dev.mellanox.co.il \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).