aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-10-17 07:16:35 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-10-17 07:16:35 -0400
commitc79d88b7fa48bc21ffd09903a98b93bf0744bce3 (patch)
treeeaaf9fd8345be724ae86d9dfc85f359d597888bf /drivers/scsi
parent5804509e652fd26227f6da732d5445af444730d3 (diff)
[SCSI] ide-scsi: remove usage of sg_last()
We want to remove sg_last(), it's a very expensive interface. So keep track of number of sg entries in the sg list, instead of comparing with the last entry. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/ide-scsi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index bd74f6c44b6b..fa7ba64483fb 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -70,7 +70,7 @@ typedef struct idescsi_pc_s {
70 u8 *buffer; /* Data buffer */ 70 u8 *buffer; /* Data buffer */
71 u8 *current_position; /* Pointer into the above buffer */ 71 u8 *current_position; /* Pointer into the above buffer */
72 struct scatterlist *sg; /* Scatter gather table */ 72 struct scatterlist *sg; /* Scatter gather table */
73 struct scatterlist *last_sg; /* Last sg element */ 73 unsigned int sg_cnt; /* Number of entries in sg */
74 int b_count; /* Bytes transferred from current entry */ 74 int b_count; /* Bytes transferred from current entry */
75 struct scsi_cmnd *scsi_cmd; /* SCSI command */ 75 struct scsi_cmnd *scsi_cmd; /* SCSI command */
76 void (*done)(struct scsi_cmnd *); /* Scsi completion routine */ 76 void (*done)(struct scsi_cmnd *); /* Scsi completion routine */
@@ -192,7 +192,7 @@ static void idescsi_input_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigne
192 } 192 }
193 bcount -= count; pc->b_count += count; 193 bcount -= count; pc->b_count += count;
194 if (pc->b_count == pc->sg->length) { 194 if (pc->b_count == pc->sg->length) {
195 if (pc->sg == pc->last_sg) 195 if (!--pc->sg_cnt)
196 break; 196 break;
197 pc->sg = sg_next(pc->sg); 197 pc->sg = sg_next(pc->sg);
198 pc->b_count = 0; 198 pc->b_count = 0;
@@ -229,7 +229,7 @@ static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsign
229 } 229 }
230 bcount -= count; pc->b_count += count; 230 bcount -= count; pc->b_count += count;
231 if (pc->b_count == pc->sg->length) { 231 if (pc->b_count == pc->sg->length) {
232 if (pc->sg == pc->last_sg) 232 if (!--pc->sg_cnt)
233 break; 233 break;
234 pc->sg = sg_next(pc->sg); 234 pc->sg = sg_next(pc->sg);
235 pc->b_count = 0; 235 pc->b_count = 0;
@@ -807,7 +807,7 @@ static int idescsi_queue (struct scsi_cmnd *cmd,
807 memcpy (pc->c, cmd->cmnd, cmd->cmd_len); 807 memcpy (pc->c, cmd->cmnd, cmd->cmd_len);
808 pc->buffer = NULL; 808 pc->buffer = NULL;
809 pc->sg = scsi_sglist(cmd); 809 pc->sg = scsi_sglist(cmd);
810 pc->last_sg = sg_last(pc->sg, scsi_sg_count(cmd)); 810 pc->sg_cnt = scsi_sg_count(cmd);
811 pc->b_count = 0; 811 pc->b_count = 0;
812 pc->request_transfer = pc->buffer_size = scsi_bufflen(cmd); 812 pc->request_transfer = pc->buffer_size = scsi_bufflen(cmd);
813 pc->scsi_cmd = cmd; 813 pc->scsi_cmd = cmd;