aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/sd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index a7b53be63367..fec034557c38 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,7 +574,7 @@ 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, sdkp->protection_type, scsi_prot_sg_count(SCpnt));
578 579
579 /* 580 /*