diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2014-09-26 19:19:59 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-09-27 11:14:50 -0400 |
commit | 3be91c4a3d090bd700bd6ee5bf457c1bbf189a4f (patch) | |
tree | 235e86f4934f132dec54a4ec376886774a59fb1a /drivers/scsi | |
parent | 5f9378fa9ca214977b5bfc12197c67eea450fc40 (diff) |
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')
-rw-r--r-- | drivers/scsi/sd_dif.c | 46 |
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) | |||
57 | { | 57 | { |
58 | void *buf = bix->data_buf; | 58 | void *buf = bix->data_buf; |
59 | struct sd_dif_tuple *sdt = bix->prot_buf; | 59 | struct sd_dif_tuple *sdt = bix->prot_buf; |
60 | sector_t sector = bix->sector; | 60 | sector_t seed = bix->seed; |
61 | unsigned int i; | 61 | unsigned int i; |
62 | 62 | ||
63 | for (i = 0 ; i < bix->data_size ; i += bix->sector_size, sdt++) { | 63 | for (i = 0 ; i < bix->data_size ; i += bix->interval, sdt++) { |
64 | sdt->guard_tag = fn(buf, bix->sector_size); | 64 | sdt->guard_tag = fn(buf, bix->interval); |
65 | sdt->ref_tag = cpu_to_be32(sector & 0xffffffff); | 65 | sdt->ref_tag = cpu_to_be32(seed & 0xffffffff); |
66 | sdt->app_tag = 0; | 66 | sdt->app_tag = 0; |
67 | 67 | ||
68 | buf += bix->sector_size; | 68 | buf += bix->interval; |
69 | sector++; | 69 | seed++; |
70 | } | 70 | } |
71 | } | 71 | } |
72 | 72 | ||
@@ -84,35 +84,35 @@ static int sd_dif_type1_verify(struct blk_integrity_exchg *bix, csum_fn *fn) | |||
84 | { | 84 | { |
85 | void *buf = bix->data_buf; | 85 | void *buf = bix->data_buf; |
86 | struct sd_dif_tuple *sdt = bix->prot_buf; | 86 | struct sd_dif_tuple *sdt = bix->prot_buf; |
87 | sector_t sector = bix->sector; | 87 | sector_t seed = bix->seed; |
88 | unsigned int i; | 88 | unsigned int i; |
89 | __u16 csum; | 89 | __u16 csum; |
90 | 90 | ||
91 | for (i = 0 ; i < bix->data_size ; i += bix->sector_size, sdt++) { | 91 | for (i = 0 ; i < bix->data_size ; i += bix->interval, sdt++) { |
92 | /* Unwritten sectors */ | 92 | /* Unwritten sectors */ |
93 | if (sdt->app_tag == 0xffff) | 93 | if (sdt->app_tag == 0xffff) |
94 | return 0; | 94 | return 0; |
95 | 95 | ||
96 | if (be32_to_cpu(sdt->ref_tag) != (sector & 0xffffffff)) { | 96 | if (be32_to_cpu(sdt->ref_tag) != (seed & 0xffffffff)) { |
97 | printk(KERN_ERR | 97 | printk(KERN_ERR |
98 | "%s: ref tag error on sector %lu (rcvd %u)\n", | 98 | "%s: ref tag error on sector %lu (rcvd %u)\n", |
99 | bix->disk_name, (unsigned long)sector, | 99 | bix->disk_name, (unsigned long)seed, |
100 | be32_to_cpu(sdt->ref_tag)); | 100 | be32_to_cpu(sdt->ref_tag)); |
101 | return -EIO; | 101 | return -EIO; |
102 | } | 102 | } |
103 | 103 | ||
104 | csum = fn(buf, bix->sector_size); | 104 | csum = fn(buf, bix->interval); |
105 | 105 | ||
106 | if (sdt->guard_tag != csum) { | 106 | if (sdt->guard_tag != csum) { |
107 | printk(KERN_ERR "%s: guard tag error on sector %lu " \ | 107 | printk(KERN_ERR "%s: guard tag error on sector %lu " \ |
108 | "(rcvd %04x, data %04x)\n", bix->disk_name, | 108 | "(rcvd %04x, data %04x)\n", bix->disk_name, |
109 | (unsigned long)sector, | 109 | (unsigned long)seed, |
110 | be16_to_cpu(sdt->guard_tag), be16_to_cpu(csum)); | 110 | be16_to_cpu(sdt->guard_tag), be16_to_cpu(csum)); |
111 | return -EIO; | 111 | return -EIO; |
112 | } | 112 | } |
113 | 113 | ||
114 | buf += bix->sector_size; | 114 | buf += bix->interval; |
115 | sector++; | 115 | seed++; |
116 | } | 116 | } |
117 | 117 | ||
118 | return 0; | 118 | return 0; |
@@ -155,12 +155,12 @@ static void sd_dif_type3_generate(struct blk_integrity_exchg *bix, csum_fn *fn) | |||
155 | struct sd_dif_tuple *sdt = bix->prot_buf; | 155 | struct sd_dif_tuple *sdt = bix->prot_buf; |
156 | unsigned int i; | 156 | unsigned int i; |
157 | 157 | ||
158 | for (i = 0 ; i < bix->data_size ; i += bix->sector_size, sdt++) { | 158 | for (i = 0 ; i < bix->data_size ; i += bix->interval, sdt++) { |
159 | sdt->guard_tag = fn(buf, bix->sector_size); | 159 | sdt->guard_tag = fn(buf, bix->interval); |
160 | sdt->ref_tag = 0; | 160 | sdt->ref_tag = 0; |
161 | sdt->app_tag = 0; | 161 | sdt->app_tag = 0; |
162 | 162 | ||
163 | buf += bix->sector_size; | 163 | buf += bix->interval; |
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
@@ -178,27 +178,27 @@ static int sd_dif_type3_verify(struct blk_integrity_exchg *bix, csum_fn *fn) | |||
178 | { | 178 | { |
179 | void *buf = bix->data_buf; | 179 | void *buf = bix->data_buf; |
180 | struct sd_dif_tuple *sdt = bix->prot_buf; | 180 | struct sd_dif_tuple *sdt = bix->prot_buf; |
181 | sector_t sector = bix->sector; | 181 | sector_t seed = bix->seed; |
182 | unsigned int i; | 182 | unsigned int i; |
183 | __u16 csum; | 183 | __u16 csum; |
184 | 184 | ||
185 | for (i = 0 ; i < bix->data_size ; i += bix->sector_size, sdt++) { | 185 | for (i = 0 ; i < bix->data_size ; i += bix->interval, sdt++) { |
186 | /* Unwritten sectors */ | 186 | /* Unwritten sectors */ |
187 | if (sdt->app_tag == 0xffff && sdt->ref_tag == 0xffffffff) | 187 | if (sdt->app_tag == 0xffff && sdt->ref_tag == 0xffffffff) |
188 | return 0; | 188 | return 0; |
189 | 189 | ||
190 | csum = fn(buf, bix->sector_size); | 190 | csum = fn(buf, bix->interval); |
191 | 191 | ||
192 | if (sdt->guard_tag != csum) { | 192 | if (sdt->guard_tag != csum) { |
193 | printk(KERN_ERR "%s: guard tag error on sector %lu " \ | 193 | printk(KERN_ERR "%s: guard tag error on sector %lu " \ |
194 | "(rcvd %04x, data %04x)\n", bix->disk_name, | 194 | "(rcvd %04x, data %04x)\n", bix->disk_name, |
195 | (unsigned long)sector, | 195 | (unsigned long)seed, |
196 | be16_to_cpu(sdt->guard_tag), be16_to_cpu(csum)); | 196 | be16_to_cpu(sdt->guard_tag), be16_to_cpu(csum)); |
197 | return -EIO; | 197 | return -EIO; |
198 | } | 198 | } |
199 | 199 | ||
200 | buf += bix->sector_size; | 200 | buf += bix->interval; |
201 | sector++; | 201 | seed++; |
202 | } | 202 | } |
203 | 203 | ||
204 | return 0; | 204 | return 0; |