aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd_dif.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/sd_dif.c')
-rw-r--r--drivers/scsi/sd_dif.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c
index 3ebb1f289490..184dff492797 100644
--- a/drivers/scsi/sd_dif.c
+++ b/drivers/scsi/sd_dif.c
@@ -142,7 +142,7 @@ static int sd_dif_type1_verify_ip(struct blk_integrity_exchg *bix)
142static void sd_dif_type1_set_tag(void *prot, void *tag_buf, unsigned int sectors) 142static void sd_dif_type1_set_tag(void *prot, void *tag_buf, unsigned int sectors)
143{ 143{
144 struct sd_dif_tuple *sdt = prot; 144 struct sd_dif_tuple *sdt = prot;
145 char *tag = tag_buf; 145 u8 *tag = tag_buf;
146 unsigned int i, j; 146 unsigned int i, j;
147 147
148 for (i = 0, j = 0 ; i < sectors ; i++, j += 2, sdt++) { 148 for (i = 0, j = 0 ; i < sectors ; i++, j += 2, sdt++) {
@@ -154,7 +154,7 @@ static void sd_dif_type1_set_tag(void *prot, void *tag_buf, unsigned int sectors
154static void sd_dif_type1_get_tag(void *prot, void *tag_buf, unsigned int sectors) 154static void sd_dif_type1_get_tag(void *prot, void *tag_buf, unsigned int sectors)
155{ 155{
156 struct sd_dif_tuple *sdt = prot; 156 struct sd_dif_tuple *sdt = prot;
157 char *tag = tag_buf; 157 u8 *tag = tag_buf;
158 unsigned int i, j; 158 unsigned int i, j;
159 159
160 for (i = 0, j = 0 ; i < sectors ; i++, j += 2, sdt++) { 160 for (i = 0, j = 0 ; i < sectors ; i++, j += 2, sdt++) {
@@ -256,7 +256,7 @@ static int sd_dif_type3_verify_ip(struct blk_integrity_exchg *bix)
256static void sd_dif_type3_set_tag(void *prot, void *tag_buf, unsigned int sectors) 256static void sd_dif_type3_set_tag(void *prot, void *tag_buf, unsigned int sectors)
257{ 257{
258 struct sd_dif_tuple *sdt = prot; 258 struct sd_dif_tuple *sdt = prot;
259 char *tag = tag_buf; 259 u8 *tag = tag_buf;
260 unsigned int i, j; 260 unsigned int i, j;
261 261
262 for (i = 0, j = 0 ; i < sectors ; i++, j += 6, sdt++) { 262 for (i = 0, j = 0 ; i < sectors ; i++, j += 6, sdt++) {
@@ -269,7 +269,7 @@ static void sd_dif_type3_set_tag(void *prot, void *tag_buf, unsigned int sectors
269static void sd_dif_type3_get_tag(void *prot, void *tag_buf, unsigned int sectors) 269static void sd_dif_type3_get_tag(void *prot, void *tag_buf, unsigned int sectors)
270{ 270{
271 struct sd_dif_tuple *sdt = prot; 271 struct sd_dif_tuple *sdt = prot;
272 char *tag = tag_buf; 272 u8 *tag = tag_buf;
273 unsigned int i, j; 273 unsigned int i, j;
274 274
275 for (i = 0, j = 0 ; i < sectors ; i++, j += 2, sdt++) { 275 for (i = 0, j = 0 ; i < sectors ; i++, j += 2, sdt++) {
@@ -374,7 +374,10 @@ void sd_dif_op(struct scsi_cmnd *scmd, unsigned int dif, unsigned int dix, unsig
374 else 374 else
375 csum_convert = 0; 375 csum_convert = 0;
376 376
377 BUG_ON(dif && (scmd->cmnd[0] == READ_6 || scmd->cmnd[0] == WRITE_6));
378
377 switch (scmd->cmnd[0]) { 379 switch (scmd->cmnd[0]) {
380 case READ_6:
378 case READ_10: 381 case READ_10:
379 case READ_12: 382 case READ_12:
380 case READ_16: 383 case READ_16:
@@ -390,6 +393,7 @@ void sd_dif_op(struct scsi_cmnd *scmd, unsigned int dif, unsigned int dix, unsig
390 393
391 break; 394 break;
392 395
396 case WRITE_6:
393 case WRITE_10: 397 case WRITE_10:
394 case WRITE_12: 398 case WRITE_12:
395 case WRITE_16: 399 case WRITE_16:
@@ -475,8 +479,9 @@ int sd_dif_prepare(struct request *rq, sector_t hw_sector, unsigned int sector_s
475 479
476error: 480error:
477 kunmap_atomic(sdt, KM_USER0); 481 kunmap_atomic(sdt, KM_USER0);
478 sd_printk(KERN_ERR, sdkp, "%s: virt %u, phys %u, ref %u\n", 482 sd_printk(KERN_ERR, sdkp, "%s: virt %u, phys %u, ref %u, app %4x\n",
479 __func__, virt, phys, be32_to_cpu(sdt->ref_tag)); 483 __func__, virt, phys, be32_to_cpu(sdt->ref_tag),
484 be16_to_cpu(sdt->app_tag));
480 485
481 return -EIO; 486 return -EIO;
482} 487}