diff options
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r-- | drivers/scsi/scsi_lib.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 39b3acfc0ddf..3d16c70fbde0 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -682,14 +682,13 @@ EXPORT_SYMBOL(scsi_release_buffers); | |||
682 | static void scsi_end_bidi_request(struct scsi_cmnd *cmd) | 682 | static void scsi_end_bidi_request(struct scsi_cmnd *cmd) |
683 | { | 683 | { |
684 | struct request *req = cmd->request; | 684 | struct request *req = cmd->request; |
685 | unsigned int dlen = req->data_len; | ||
686 | unsigned int next_dlen = req->next_rq->data_len; | ||
687 | 685 | ||
688 | req->resid_len = scsi_out(cmd)->resid; | 686 | req->resid_len = scsi_out(cmd)->resid; |
689 | req->next_rq->resid_len = scsi_in(cmd)->resid; | 687 | req->next_rq->resid_len = scsi_in(cmd)->resid; |
690 | 688 | ||
691 | /* The req and req->next_rq have not been completed */ | 689 | /* The req and req->next_rq have not been completed */ |
692 | BUG_ON(blk_end_bidi_request(req, 0, dlen, next_dlen)); | 690 | BUG_ON(blk_end_bidi_request(req, 0, blk_rq_bytes(req), |
691 | blk_rq_bytes(req->next_rq))); | ||
693 | 692 | ||
694 | scsi_release_buffers(cmd); | 693 | scsi_release_buffers(cmd); |
695 | 694 | ||
@@ -966,7 +965,7 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb, | |||
966 | BUG_ON(count > sdb->table.nents); | 965 | BUG_ON(count > sdb->table.nents); |
967 | sdb->table.nents = count; | 966 | sdb->table.nents = count; |
968 | if (blk_pc_request(req)) | 967 | if (blk_pc_request(req)) |
969 | sdb->length = req->data_len; | 968 | sdb->length = blk_rq_bytes(req); |
970 | else | 969 | else |
971 | sdb->length = blk_rq_sectors(req) << 9; | 970 | sdb->length = blk_rq_sectors(req) << 9; |
972 | return BLKPREP_OK; | 971 | return BLKPREP_OK; |
@@ -1087,21 +1086,21 @@ int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req) | |||
1087 | if (unlikely(ret)) | 1086 | if (unlikely(ret)) |
1088 | return ret; | 1087 | return ret; |
1089 | } else { | 1088 | } else { |
1090 | BUG_ON(req->data_len); | 1089 | BUG_ON(blk_rq_bytes(req)); |
1091 | 1090 | ||
1092 | memset(&cmd->sdb, 0, sizeof(cmd->sdb)); | 1091 | memset(&cmd->sdb, 0, sizeof(cmd->sdb)); |
1093 | req->buffer = NULL; | 1092 | req->buffer = NULL; |
1094 | } | 1093 | } |
1095 | 1094 | ||
1096 | cmd->cmd_len = req->cmd_len; | 1095 | cmd->cmd_len = req->cmd_len; |
1097 | if (!req->data_len) | 1096 | if (!blk_rq_bytes(req)) |
1098 | cmd->sc_data_direction = DMA_NONE; | 1097 | cmd->sc_data_direction = DMA_NONE; |
1099 | else if (rq_data_dir(req) == WRITE) | 1098 | else if (rq_data_dir(req) == WRITE) |
1100 | cmd->sc_data_direction = DMA_TO_DEVICE; | 1099 | cmd->sc_data_direction = DMA_TO_DEVICE; |
1101 | else | 1100 | else |
1102 | cmd->sc_data_direction = DMA_FROM_DEVICE; | 1101 | cmd->sc_data_direction = DMA_FROM_DEVICE; |
1103 | 1102 | ||
1104 | cmd->transfersize = req->data_len; | 1103 | cmd->transfersize = blk_rq_bytes(req); |
1105 | cmd->allowed = req->retries; | 1104 | cmd->allowed = req->retries; |
1106 | return BLKPREP_OK; | 1105 | return BLKPREP_OK; |
1107 | } | 1106 | } |