aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 5987da857103..1646fe7cbd4b 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -749,9 +749,9 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
749 */ 749 */
750 req->next_rq->resid_len = scsi_in(cmd)->resid; 750 req->next_rq->resid_len = scsi_in(cmd)->resid;
751 751
752 scsi_release_buffers(cmd);
752 blk_end_request_all(req, 0); 753 blk_end_request_all(req, 0);
753 754
754 scsi_release_buffers(cmd);
755 scsi_next_command(cmd); 755 scsi_next_command(cmd);
756 return; 756 return;
757 } 757 }
@@ -773,8 +773,14 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
773 * we already took a copy of the original into rq->errors which 773 * we already took a copy of the original into rq->errors which
774 * is what gets returned to the user 774 * is what gets returned to the user
775 */ 775 */
776 if (sense_valid && sshdr.sense_key == RECOVERED_ERROR) { 776 if (sense_valid && (sshdr.sense_key == RECOVERED_ERROR)) {
777 if (!(req->cmd_flags & REQ_QUIET)) 777 /* if ATA PASS-THROUGH INFORMATION AVAILABLE skip
778 * print since caller wants ATA registers. Only occurs on
779 * SCSI ATA PASS_THROUGH commands when CK_COND=1
780 */
781 if ((sshdr.asc == 0x0) && (sshdr.ascq == 0x1d))
782 ;
783 else if (!(req->cmd_flags & REQ_QUIET))
778 scsi_print_sense("", cmd); 784 scsi_print_sense("", cmd);
779 result = 0; 785 result = 0;
780 /* BLOCK_PC may have set error */ 786 /* BLOCK_PC may have set error */
@@ -859,6 +865,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
859 case 0x07: /* operation in progress */ 865 case 0x07: /* operation in progress */
860 case 0x08: /* Long write in progress */ 866 case 0x08: /* Long write in progress */
861 case 0x09: /* self test in progress */ 867 case 0x09: /* self test in progress */
868 case 0x14: /* space allocation in progress */
862 action = ACTION_DELAYED_RETRY; 869 action = ACTION_DELAYED_RETRY;
863 break; 870 break;
864 default: 871 default:
@@ -898,7 +905,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
898 scsi_print_sense("", cmd); 905 scsi_print_sense("", cmd);
899 scsi_print_command(cmd); 906 scsi_print_command(cmd);
900 } 907 }
901 if (blk_end_request_err(req, -EIO)) 908 if (blk_end_request_err(req, error))
902 scsi_requeue_command(q, cmd); 909 scsi_requeue_command(q, cmd);
903 else 910 else
904 scsi_next_command(cmd); 911 scsi_next_command(cmd);
@@ -1359,9 +1366,9 @@ static int scsi_lld_busy(struct request_queue *q)
1359static void scsi_kill_request(struct request *req, struct request_queue *q) 1366static void scsi_kill_request(struct request *req, struct request_queue *q)
1360{ 1367{
1361 struct scsi_cmnd *cmd = req->special; 1368 struct scsi_cmnd *cmd = req->special;
1362 struct scsi_device *sdev = cmd->device; 1369 struct scsi_device *sdev;
1363 struct scsi_target *starget = scsi_target(sdev); 1370 struct scsi_target *starget;
1364 struct Scsi_Host *shost = sdev->host; 1371 struct Scsi_Host *shost;
1365 1372
1366 blk_start_request(req); 1373 blk_start_request(req);
1367 1374
@@ -1371,6 +1378,9 @@ static void scsi_kill_request(struct request *req, struct request_queue *q)
1371 BUG(); 1378 BUG();
1372 } 1379 }
1373 1380
1381 sdev = cmd->device;
1382 starget = scsi_target(sdev);
1383 shost = sdev->host;
1374 scsi_init_cmd_errh(cmd); 1384 scsi_init_cmd_errh(cmd);
1375 cmd->result = DID_NO_CONNECT << 16; 1385 cmd->result = DID_NO_CONNECT << 16;
1376 atomic_inc(&cmd->device->iorequest_cnt); 1386 atomic_inc(&cmd->device->iorequest_cnt);
@@ -1620,10 +1630,10 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost,
1620 /* 1630 /*
1621 * this limit is imposed by hardware restrictions 1631 * this limit is imposed by hardware restrictions
1622 */ 1632 */
1623 blk_queue_max_hw_segments(q, shost->sg_tablesize); 1633 blk_queue_max_segments(q, min_t(unsigned short, shost->sg_tablesize,
1624 blk_queue_max_phys_segments(q, SCSI_MAX_SG_CHAIN_SEGMENTS); 1634 SCSI_MAX_SG_CHAIN_SEGMENTS));
1625 1635
1626 blk_queue_max_sectors(q, shost->max_sectors); 1636 blk_queue_max_hw_sectors(q, shost->max_sectors);
1627 blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost)); 1637 blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost));
1628 blk_queue_segment_boundary(q, shost->dma_boundary); 1638 blk_queue_segment_boundary(q, shost->dma_boundary);
1629 dma_set_seg_boundary(dev, shost->dma_boundary); 1639 dma_set_seg_boundary(dev, shost->dma_boundary);