diff options
Diffstat (limited to 'drivers/scsi/sd.c')
| -rw-r--r-- | drivers/scsi/sd.c | 23 | 
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 9421d9877730..a58cee7a85f2 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1119,7 +1119,7 @@ static int sd_setup_read_write_cmnd(struct scsi_cmnd *SCpnt)  		SCpnt->cmnd[0] = WRITE_6;  		if (blk_integrity_rq(rq)) -			sd_dif_prepare(SCpnt); +			t10_pi_prepare(SCpnt->request, sdkp->protection_type);  	} else if (rq_data_dir(rq) == READ) {  		SCpnt->cmnd[0] = READ_6; @@ -1635,7 +1635,7 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)  	if (res) {  		sd_print_result(sdkp, "Synchronize Cache(10) failed", res); -		if (driver_byte(res) & DRIVER_SENSE) +		if (driver_byte(res) == DRIVER_SENSE)  			sd_print_sense_hdr(sdkp, sshdr);  		/* we need to evaluate the error return  */ @@ -1737,8 +1737,8 @@ static int sd_pr_command(struct block_device *bdev, u8 sa,  	result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, &data, sizeof(data),  			&sshdr, SD_TIMEOUT, SD_MAX_RETRIES, NULL); -	if ((driver_byte(result) & DRIVER_SENSE) && -	    (scsi_sense_valid(&sshdr))) { +	if (driver_byte(result) == DRIVER_SENSE && +	    scsi_sense_valid(&sshdr)) {  		sdev_printk(KERN_INFO, sdev, "PR command failed: %d\n", result);  		scsi_print_sense_hdr(sdev, NULL, &sshdr);  	} @@ -2028,7 +2028,6 @@ static int sd_done(struct scsi_cmnd *SCpnt)  				} else {  					sdkp->device->no_write_same = 1;  					sd_config_write_same(sdkp); -					req->__data_len = blk_rq_bytes(req);  					req->rq_flags |= RQF_QUIET;  				}  				break; @@ -2047,8 +2046,10 @@ static int sd_done(struct scsi_cmnd *SCpnt)  					   "sd_done: completed %d of %d bytes\n",  					   good_bytes, scsi_bufflen(SCpnt))); -	if (rq_data_dir(SCpnt->request) == READ && scsi_prot_sg_count(SCpnt)) -		sd_dif_complete(SCpnt, good_bytes); +	if (rq_data_dir(SCpnt->request) == READ && scsi_prot_sg_count(SCpnt) && +	    good_bytes) +		t10_pi_complete(SCpnt->request, sdkp->protection_type, +				good_bytes / scsi_prot_interval(SCpnt));  	return good_bytes;  } @@ -2095,10 +2096,10 @@ sd_spinup_disk(struct scsi_disk *sdkp)  			retries++;  		} while (retries < 3 &&   			 (!scsi_status_is_good(the_result) || -			  ((driver_byte(the_result) & DRIVER_SENSE) && +			  ((driver_byte(the_result) == DRIVER_SENSE) &&  			  sense_valid && sshdr.sense_key == UNIT_ATTENTION))); -		if ((driver_byte(the_result) & DRIVER_SENSE) == 0) { +		if (driver_byte(the_result) != DRIVER_SENSE) {  			/* no sense, TUR either succeeded or failed  			 * with a status error */  			if(!spintime && !scsi_status_is_good(the_result)) { @@ -2224,7 +2225,7 @@ static void read_capacity_error(struct scsi_disk *sdkp, struct scsi_device *sdp,  			struct scsi_sense_hdr *sshdr, int sense_valid,  			int the_result)  { -	if (driver_byte(the_result) & DRIVER_SENSE) +	if (driver_byte(the_result) == DRIVER_SENSE)  		sd_print_sense_hdr(sdkp, sshdr);  	else  		sd_printk(KERN_NOTICE, sdkp, "Sense not available.\n"); @@ -3490,7 +3491,7 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start)  			SD_TIMEOUT, SD_MAX_RETRIES, 0, RQF_PM, NULL);  	if (res) {  		sd_print_result(sdkp, "Start/Stop Unit failed", res); -		if (driver_byte(res) & DRIVER_SENSE) +		if (driver_byte(res) == DRIVER_SENSE)  			sd_print_sense_hdr(sdkp, &sshdr);  		if (scsi_sense_valid(&sshdr) &&  			/* 0x3a is medium not present */  |