aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-05-07 09:24:42 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-05-11 03:50:55 -0400
commitb0790410300abaaf4f25f702803beff701baebf1 (patch)
tree63d8fcd38e4cd5927fd83e482e306480bb68a689 /drivers/scsi/scsi_lib.c
parent2e46e8b27aa57c6bd34b3102b40ee4d0144b4fab (diff)
block: cleanup rq->data_len usages
With recent unification of fields, it's now guaranteed that rq->data_len always equals blk_rq_bytes(). Convert all non-IDE direct users to accessors. IDE will be converted in a separate patch. Boaz: spotted incorrect data_len/resid_len conversion in osd. [ Impact: convert direct rq->data_len usages to blk_rq_bytes() ] Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Cc: Pete Zaitcev <zaitcev@redhat.com> Cc: Eric Moore <Eric.Moore@lsi.com> Cc: Markus Lidel <Markus.Lidel@shadowconnect.com> Cc: Darrick J. Wong <djwong@us.ibm.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Cc: Eric Moore <Eric.Moore@lsi.com> Cc: Boaz Harrosh <bharrosh@panasas.com> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c13
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);
682static void scsi_end_bidi_request(struct scsi_cmnd *cmd) 682static 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}