diff options
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r-- | drivers/scsi/sd.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index a7b53be63367..7c4d2e68df1c 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -384,7 +384,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) | |||
384 | sector_t block = rq->sector; | 384 | sector_t block = rq->sector; |
385 | sector_t threshold; | 385 | sector_t threshold; |
386 | unsigned int this_count = rq->nr_sectors; | 386 | unsigned int this_count = rq->nr_sectors; |
387 | int ret; | 387 | int ret, host_dif; |
388 | 388 | ||
389 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { | 389 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { |
390 | ret = scsi_setup_blk_pc_cmnd(sdp, rq); | 390 | ret = scsi_setup_blk_pc_cmnd(sdp, rq); |
@@ -515,7 +515,8 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) | |||
515 | rq->nr_sectors)); | 515 | rq->nr_sectors)); |
516 | 516 | ||
517 | /* Set RDPROTECT/WRPROTECT if disk is formatted with DIF */ | 517 | /* Set RDPROTECT/WRPROTECT if disk is formatted with DIF */ |
518 | if (scsi_host_dif_capable(sdp->host, sdkp->protection_type)) | 518 | host_dif = scsi_host_dif_capable(sdp->host, sdkp->protection_type); |
519 | if (host_dif) | ||
519 | SCpnt->cmnd[1] = 1 << 5; | 520 | SCpnt->cmnd[1] = 1 << 5; |
520 | else | 521 | else |
521 | SCpnt->cmnd[1] = 0; | 522 | SCpnt->cmnd[1] = 0; |
@@ -573,8 +574,9 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) | |||
573 | SCpnt->sdb.length = this_count * sdp->sector_size; | 574 | SCpnt->sdb.length = this_count * sdp->sector_size; |
574 | 575 | ||
575 | /* If DIF or DIX is enabled, tell HBA how to handle request */ | 576 | /* If DIF or DIX is enabled, tell HBA how to handle request */ |
576 | if (sdkp->protection_type || scsi_prot_sg_count(SCpnt)) | 577 | if (host_dif || scsi_prot_sg_count(SCpnt)) |
577 | sd_dif_op(SCpnt, sdkp->protection_type, scsi_prot_sg_count(SCpnt)); | 578 | sd_dif_op(SCpnt, host_dif, scsi_prot_sg_count(SCpnt), |
579 | sdkp->protection_type); | ||
578 | 580 | ||
579 | /* | 581 | /* |
580 | * We shouldn't disconnect in the middle of a sector, so with a dumb | 582 | * We shouldn't disconnect in the middle of a sector, so with a dumb |
@@ -1252,14 +1254,12 @@ void sd_read_protection_type(struct scsi_disk *sdkp, unsigned char *buffer) | |||
1252 | else | 1254 | else |
1253 | type = ((buffer[12] >> 1) & 7) + 1; /* P_TYPE 0 = Type 1 */ | 1255 | type = ((buffer[12] >> 1) & 7) + 1; /* P_TYPE 0 = Type 1 */ |
1254 | 1256 | ||
1257 | sdkp->protection_type = type; | ||
1258 | |||
1255 | switch (type) { | 1259 | switch (type) { |
1256 | case SD_DIF_TYPE0_PROTECTION: | 1260 | case SD_DIF_TYPE0_PROTECTION: |
1257 | sdkp->protection_type = 0; | ||
1258 | break; | ||
1259 | |||
1260 | case SD_DIF_TYPE1_PROTECTION: | 1261 | case SD_DIF_TYPE1_PROTECTION: |
1261 | case SD_DIF_TYPE3_PROTECTION: | 1262 | case SD_DIF_TYPE3_PROTECTION: |
1262 | sdkp->protection_type = type; | ||
1263 | break; | 1263 | break; |
1264 | 1264 | ||
1265 | case SD_DIF_TYPE2_PROTECTION: | 1265 | case SD_DIF_TYPE2_PROTECTION: |
@@ -1277,7 +1277,6 @@ void sd_read_protection_type(struct scsi_disk *sdkp, unsigned char *buffer) | |||
1277 | return; | 1277 | return; |
1278 | 1278 | ||
1279 | disable: | 1279 | disable: |
1280 | sdkp->protection_type = 0; | ||
1281 | sdkp->capacity = 0; | 1280 | sdkp->capacity = 0; |
1282 | } | 1281 | } |
1283 | 1282 | ||