secret

This patch configures the HDD cache for optimal performance even during raw block I/O to and from the block device. This patch does NOT introduce any regression for file-system read/writes.

  • Download Gist
optimise-sata-raw-block-io-speed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
From a5ba7f15275fb43818727e5c735e593a32fe7c89 Mon Sep 17 00:00:00 2001
From: Chinmay V S <cvs268@gmail.com>
Date: Fri, 6 Jul 2012 16:39:37 +0530
Subject: [PATCH] Enable maximum HDD throughput during raw blk I/O.
 
This patch configures the HDD cache for optimal performance even during
raw block I/O to and from the block device. This patch does NOT
introduce any regression for file-system read/writes.
 
Signed-off-by: Chinmay V S <cvs268@gmail.com>
---
drivers/ata/libahci.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
 
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index f20c4c9..e091df9 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -72,6 +72,8 @@ static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc);
static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc);
static int ahci_port_start(struct ata_port *ap);
static void ahci_port_stop(struct ata_port *ap);
+static unsigned int ahci_dummy_read_id(struct ata_device *adev,
+ struct ata_taskfile *tf, u16 *id);
static void ahci_qc_prep(struct ata_queued_cmd *qc);
static int ahci_pmp_qc_defer(struct ata_queued_cmd *qc);
static void ahci_freeze(struct ata_port *ap);
@@ -174,6 +178,7 @@ struct ata_port_operations ahci_ops = {
#endif
.port_start = ahci_port_start,
.port_stop = ahci_port_stop,
+ .read_id = ahci_dummy_read_id,
};
EXPORT_SYMBOL_GPL(ahci_ops);
@@ -2046,6 +2053,23 @@ static void ahci_port_stop(struct ata_port *ap)
ata_port_printk(ap, KERN_WARNING, "%s (%d)\n", emsg, rc);
}
+static unsigned int ahci_dummy_read_id(struct ata_device *adev,
+ struct ata_taskfile *tf, u16 *id)
+{
+ unsigned int err_mask;
+ unsigned char model_num[ATA_ID_PROD_LEN + 1];
+
+ err_mask = ata_do_dev_read_id(adev, tf, id);
+ if (err_mask)
+ return err_mask;
+
+ id[83] &= ~(1 << 12); /* Cache flush */
+ id[83] &= ~(1 << 13); /* LBA48 flush */
+ id[85] &= ~(1 << 5); /* Write cache */
+
+ return err_mask;
+}
+
void ahci_print_info(struct ata_host *host, const char *scc_s)
{
struct ahci_host_priv *hpriv = host->private_data;
--
1.7.5.4

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.