diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-10-18 16:21:18 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-18 16:21:18 -0400 |
commit | 3be6cbd73f74b4a3da82cc7d6e1688a4ae595fc7 (patch) | |
tree | a077cf70d1cd438db34f5def23dd8f72f42b5a8c /drivers/ata/pdc_adma.c | |
parent | 858c9c406688bc7244986b5836265071edfd1d3f (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/ata/pdc_adma.c')
-rw-r--r-- | drivers/ata/pdc_adma.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c index 8d1b03d5bcb1..199f7e150eb3 100644 --- a/drivers/ata/pdc_adma.c +++ b/drivers/ata/pdc_adma.c @@ -318,7 +318,7 @@ static int adma_fill_sg(struct ata_queued_cmd *qc) struct scatterlist *sg; struct ata_port *ap = qc->ap; struct adma_port_priv *pp = ap->private_data; - u8 *buf = pp->pkt; + u8 *buf = pp->pkt, *last_buf = NULL; int i = (2 + buf[3]) * 8; u8 pFLAGS = pORD | ((qc->tf.flags & ATA_TFLAG_WRITE) ? pDIRO : 0); @@ -334,8 +334,7 @@ static int adma_fill_sg(struct ata_queued_cmd *qc) *(__le32 *)(buf + i) = cpu_to_le32(len); i += 4; - if (ata_sg_is_last(sg, qc)) - pFLAGS |= pEND; + last_buf = &buf[i]; buf[i++] = pFLAGS; buf[i++] = qc->dev->dma_mode & 0xf; buf[i++] = 0; /* pPKLW */ @@ -348,6 +347,10 @@ static int adma_fill_sg(struct ata_queued_cmd *qc) VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", i/4, (unsigned long)addr, len); } + + if (likely(last_buf)) + *last_buf |= pEND; + return i; } |