[RESEND RFC PATCH] libata: cache device select

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Avoid the device select overhead on every qc_issue (> 10uS) by caching the
currently selected device. This shows up on profiles under load.

Signed-off-by: Alan Cox <alan@xxxxxxxxxxxxxxx>
---

 drivers/ata/libata-sff.c |    6 +++++-
 include/linux/libata.h   |    1 +
 2 files changed, 6 insertions(+), 1 deletions(-)


diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 4b57ae9..4fb1229 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -470,6 +470,7 @@ void ata_sff_dev_select(struct ata_port *ap, unsigned int device)
 
 	iowrite8(tmp, ap->ioaddr.device_addr);
 	ata_sff_pause(ap);	/* needed; also flushes, for mmio */
+	ap->sff_selected = device;
 }
 EXPORT_SYMBOL_GPL(ata_sff_dev_select);
 
@@ -1559,7 +1560,8 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc)
 	}
 
 	/* select the device */
-	ata_dev_select(ap, qc->dev->devno, 1, 0);
+	if (qc->dev->devno != ap->sff_selected)
+        	ata_dev_select(ap, qc->dev->devno, 1, 0);
 
 	/* start the command */
 	switch (qc->tf.protocol) {
@@ -1971,6 +1973,8 @@ int ata_sff_prereset(struct ata_link *link, unsigned long deadline)
 	struct ata_eh_context *ehc = &link->eh_context;
 	int rc;
 
+	link->ap->sff_selected = -1;	/* Unknown */
+
 	rc = ata_std_prereset(link, deadline);
 	if (rc)
 		return rc;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index c4811d9..63a9489 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -727,6 +727,7 @@ struct ata_port {
 
 #ifdef CONFIG_ATA_SFF
 	struct ata_ioports	ioaddr;	/* ATA cmd/ctl/dma register blocks */
+	int			sff_selected;	/* Cache of selected device */
 #endif /* CONFIG_ATA_SFF */
 
 	u8			ctl;	/* cache of ATA control register */

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux