提交 c79d88b7 编写于 作者: J Jens Axboe

[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: NJens Axboe <jens.axboe@oracle.com>
上级 5804509e
...@@ -70,7 +70,7 @@ typedef struct idescsi_pc_s { ...@@ -70,7 +70,7 @@ typedef struct idescsi_pc_s {
u8 *buffer; /* Data buffer */ u8 *buffer; /* Data buffer */
u8 *current_position; /* Pointer into the above buffer */ u8 *current_position; /* Pointer into the above buffer */
struct scatterlist *sg; /* Scatter gather table */ struct scatterlist *sg; /* Scatter gather table */
struct scatterlist *last_sg; /* Last sg element */ unsigned int sg_cnt; /* Number of entries in sg */
int b_count; /* Bytes transferred from current entry */ int b_count; /* Bytes transferred from current entry */
struct scsi_cmnd *scsi_cmd; /* SCSI command */ struct scsi_cmnd *scsi_cmd; /* SCSI command */
void (*done)(struct scsi_cmnd *); /* Scsi completion routine */ 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,7 +192,7 @@ static void idescsi_input_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigne
} }
bcount -= count; pc->b_count += count; bcount -= count; pc->b_count += count;
if (pc->b_count == pc->sg->length) { if (pc->b_count == pc->sg->length) {
if (pc->sg == pc->last_sg) if (!--pc->sg_cnt)
break; break;
pc->sg = sg_next(pc->sg); pc->sg = sg_next(pc->sg);
pc->b_count = 0; pc->b_count = 0;
...@@ -229,7 +229,7 @@ static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsign ...@@ -229,7 +229,7 @@ static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsign
} }
bcount -= count; pc->b_count += count; bcount -= count; pc->b_count += count;
if (pc->b_count == pc->sg->length) { if (pc->b_count == pc->sg->length) {
if (pc->sg == pc->last_sg) if (!--pc->sg_cnt)
break; break;
pc->sg = sg_next(pc->sg); pc->sg = sg_next(pc->sg);
pc->b_count = 0; pc->b_count = 0;
...@@ -807,7 +807,7 @@ static int idescsi_queue (struct scsi_cmnd *cmd, ...@@ -807,7 +807,7 @@ static int idescsi_queue (struct scsi_cmnd *cmd,
memcpy (pc->c, cmd->cmnd, cmd->cmd_len); memcpy (pc->c, cmd->cmnd, cmd->cmd_len);
pc->buffer = NULL; pc->buffer = NULL;
pc->sg = scsi_sglist(cmd); pc->sg = scsi_sglist(cmd);
pc->last_sg = sg_last(pc->sg, scsi_sg_count(cmd)); pc->sg_cnt = scsi_sg_count(cmd);
pc->b_count = 0; pc->b_count = 0;
pc->request_transfer = pc->buffer_size = scsi_bufflen(cmd); pc->request_transfer = pc->buffer_size = scsi_bufflen(cmd);
pc->scsi_cmd = cmd; pc->scsi_cmd = cmd;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册