aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ipr.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-18 16:21:18 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-18 16:21:18 -0400
commit3be6cbd73f74b4a3da82cc7d6e1688a4ae595fc7 (patch)
treea077cf70d1cd438db34f5def23dd8f72f42b5a8c /drivers/scsi/ipr.c
parent858c9c406688bc7244986b5836265071edfd1d3f (diff)
[libata] kill ata_sg_is_last()
Short term, this works around a bug introduced by early sg-chaining work. Long term, removing this function eliminates a branch from a hot path loop in each scatter/gather table build. Also, as this code demonstrates, we don't need to _track_ the end of the s/g list, as long as we mark it in some way. And doing so programatically is nice. So its a useful cleanup, regardless of its short term effects. Based conceptually on a quick patch by Jens Axboe. Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/scsi/ipr.c')
-rw-r--r--drivers/scsi/ipr.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index b41dfb539021..c316a0bcae6c 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -5134,6 +5134,7 @@ static void ipr_build_ata_ioadl(struct ipr_cmnd *ipr_cmd,
5134 u32 ioadl_flags = 0; 5134 u32 ioadl_flags = 0;
5135 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; 5135 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
5136 struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl; 5136 struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl;
5137 struct ipr_ioadl_desc *last_ioadl = NULL;
5137 int len = qc->nbytes + qc->pad_len; 5138 int len = qc->nbytes + qc->pad_len;
5138 struct scatterlist *sg; 5139 struct scatterlist *sg;
5139 5140
@@ -5156,11 +5157,13 @@ static void ipr_build_ata_ioadl(struct ipr_cmnd *ipr_cmd,
5156 ata_for_each_sg(sg, qc) { 5157 ata_for_each_sg(sg, qc) {
5157 ioadl->flags_and_data_len = cpu_to_be32(ioadl_flags | sg_dma_len(sg)); 5158 ioadl->flags_and_data_len = cpu_to_be32(ioadl_flags | sg_dma_len(sg));
5158 ioadl->address = cpu_to_be32(sg_dma_address(sg)); 5159 ioadl->address = cpu_to_be32(sg_dma_address(sg));
5159 if (ata_sg_is_last(sg, qc)) 5160
5160 ioadl->flags_and_data_len |= cpu_to_be32(IPR_IOADL_FLAGS_LAST); 5161 last_ioadl = ioadl;
5161 else 5162 ioadl++;
5162 ioadl++;
5163 } 5163 }
5164
5165 if (likely(last_ioadl))
5166 last_ioadl->flags_and_data_len |= cpu_to_be32(IPR_IOADL_FLAGS_LAST);
5164} 5167}
5165 5168
5166/** 5169/**