Re: [git patch] another libata fix

Previous thread: OOM notifications by Marcelo Tosatti on Thursday, October 18, 2007 - 1:25 pm. (10 messages)

Next thread: Re: [RFC PATCH 0/5] Shadow directories by David Newall on Thursday, October 18, 2007 - 1:37 pm. (4 messages)
From: Jeff Garzik
Date: Thursday, October 18, 2007 - 1:24 pm

NOTE:  This is appended to the previous libata fixes, in a linear
history.  If you pull this, and have not pulled yesterday's submission,
you will get -both-.  If you pulled yesterday's fixes, you will only get
the single changeset below.

Please pull from 'upstream-linus' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git upstream-linus

to receive the following updates:

 drivers/ata/pdc_adma.c   |    9 +-
 drivers/ata/sata_mv.c    |   26 +-
 drivers/ata/sata_sil24.c |   11 +-
 drivers/scsi/ipr.c       |   11 +-
 include/linux/libata.h   |   12 -
 11 files changed, 1567 insertions(+), 90 deletions(-)
 create mode 100644 drivers/ata/sata_fsl.c


[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>



diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c
index 8d1b03d..199f7e1 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;
 ...
From: Jeff Garzik
Date: Thursday, October 18, 2007 - 1:26 pm

And if it wasn't clear from the flurry of emails, this is independent 
from and parallel to Jens' current work.

So, it should not conflict, and it fixes several do-not-work-at-all 
drivers broken by sg-chaining.

	Jeff



-

Previous thread: OOM notifications by Marcelo Tosatti on Thursday, October 18, 2007 - 1:25 pm. (10 messages)

Next thread: Re: [RFC PATCH 0/5] Shadow directories by David Newall on Thursday, October 18, 2007 - 1:37 pm. (4 messages)