summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd_dif.c
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2014-09-26 19:19:59 -0400
committerJens Axboe <axboe@fb.com>2014-09-27 09:14:50 -0600
commit3be91c4a3d090bd700bd6ee5bf457c1bbf189a4f (patch)
tree235e86f4934f132dec54a4ec376886774a59fb1a /drivers/scsi/sd_dif.c
parent5f9378fa9ca214977b5bfc12197c67eea450fc40 (diff)
downloadlinux-3be91c4a3d090bd700bd6ee5bf457c1bbf189a4f.tar.bz2
block: Deprecate the use of the term sector in the context of block integrity
The protection interval is not necessarily tied to the logical block size of a block device. Stop using the terms "sector" and "sectors". Going forward we will use the term "seed" to describe the initial reference tag value for a given I/O. "Interval" will be used to describe the portion of the data buffer that a given piece of protection information is associated with. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/scsi/sd_dif.c')
-rw-r--r--drivers/scsi/sd_dif.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c
index 38a7778631be..1600270a46e5 100644
--- a/drivers/scsi/sd_dif.c
+++ b/drivers/scsi/sd_dif.c
@@ -57,16 +57,16 @@ static void sd_dif_type1_generate(struct blk_integrity_exchg *bix, csum_fn *fn)
{
void *buf = bix->data_buf;
struct sd_dif_tuple *sdt = bix->prot_buf;
- sector_t sector = bix->sector;
+ sector_t seed = bix->seed;
unsigned int i;
- for (i = 0 ; i < bix->data_size ; i += bix->sector_size, sdt++) {
- sdt->guard_tag = fn(buf, bix->sector_size);
- sdt->ref_tag = cpu_to_be32(sector & 0xffffffff);
+ for (i = 0 ; i < bix->data_size ; i += bix->interval, sdt++) {
+ sdt->guard_tag = fn(buf, bix->interval);
+ sdt->ref_tag = cpu_to_be32(seed & 0xffffffff);
sdt->app_tag = 0;
- buf += bix->sector_size;
- sector++;
+ buf += bix->interval;
+ seed++;
}
}
@@ -84,35 +84,35 @@ static int sd_dif_type1_verify(struct blk_integrity_exchg *bix, csum_fn *fn)
{
void *buf = bix->data_buf;
struct sd_dif_tuple *sdt = bix->prot_buf;
- sector_t sector = bix->sector;
+ sector_t seed = bix->seed;
unsigned int i;
__u16 csum;
- for (i = 0 ; i < bix->data_size ; i += bix->sector_size, sdt++) {
+ for (i = 0 ; i < bix->data_size ; i += bix->interval, sdt++) {
/* Unwritten sectors */
if (sdt->app_tag == 0xffff)
return 0;
- if (be32_to_cpu(sdt->ref_tag) != (sector & 0xffffffff)) {
+ if (be32_to_cpu(sdt->ref_tag) != (seed & 0xffffffff)) {
printk(KERN_ERR
"%s: ref tag error on sector %lu (rcvd %u)\n",
- bix->disk_name, (unsigned long)sector,
+ bix->disk_name, (unsigned long)seed,
be32_to_cpu(sdt->ref_tag));
return -EIO;
}
- csum = fn(buf, bix->sector_size);
+ csum = fn(buf, bix->interval);
if (sdt->guard_tag != csum) {
printk(KERN_ERR "%s: guard tag error on sector %lu " \
"(rcvd %04x, data %04x)\n", bix->disk_name,
- (unsigned long)sector,
+ (unsigned long)seed,
be16_to_cpu(sdt->guard_tag), be16_to_cpu(csum));
return -EIO;
}
- buf += bix->sector_size;
- sector++;
+ buf += bix->interval;
+ seed++;
}
return 0;
@@ -155,12 +155,12 @@ static void sd_dif_type3_generate(struct blk_integrity_exchg *bix, csum_fn *fn)
struct sd_dif_tuple *sdt = bix->prot_buf;
unsigned int i;
- for (i = 0 ; i < bix->data_size ; i += bix->sector_size, sdt++) {
- sdt->guard_tag = fn(buf, bix->sector_size);
+ for (i = 0 ; i < bix->data_size ; i += bix->interval, sdt++) {
+ sdt->guard_tag = fn(buf, bix->interval);
sdt->ref_tag = 0;
sdt->app_tag = 0;
- buf += bix->sector_size;
+ buf += bix->interval;
}
}
@@ -178,27 +178,27 @@ static int sd_dif_type3_verify(struct blk_integrity_exchg *bix, csum_fn *fn)
{
void *buf = bix->data_buf;
struct sd_dif_tuple *sdt = bix->prot_buf;
- sector_t sector = bix->sector;
+ sector_t seed = bix->seed;
unsigned int i;
__u16 csum;
- for (i = 0 ; i < bix->data_size ; i += bix->sector_size, sdt++) {
+ for (i = 0 ; i < bix->data_size ; i += bix->interval, sdt++) {
/* Unwritten sectors */
if (sdt->app_tag == 0xffff && sdt->ref_tag == 0xffffffff)
return 0;
- csum = fn(buf, bix->sector_size);
+ csum = fn(buf, bix->interval);
if (sdt->guard_tag != csum) {
printk(KERN_ERR "%s: guard tag error on sector %lu " \
"(rcvd %04x, data %04x)\n", bix->disk_name,
- (unsigned long)sector,
+ (unsigned long)seed,
be16_to_cpu(sdt->guard_tag), be16_to_cpu(csum));
return -EIO;
}
- buf += bix->sector_size;
- sector++;
+ buf += bix->interval;
+ seed++;
}
return 0;