Skip to content

Instantly share code, notes, and snippets.

@TheCodeArtist
Last active October 7, 2015 19:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheCodeArtist/93dddcd6a21dc81414ba to your computer and use it in GitHub Desktop.
Save TheCodeArtist/93dddcd6a21dc81414ba to your computer and use it in GitHub Desktop.
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.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment