Skip to contentSkip to conversation

Patch "libata: add ATA_HORKAGE_NOTRIM" has been added to the 4.1-stable tree

PATCH [email protected] 1 participant 1 message Jul 30, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

libata: add ATA_HORKAGE_NOTRIM

to the 4.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
libata-add-ata_horkage_notrim.patch
and it can be found in the queue-4.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 71d126fd28de2d4d9b7b2088dbccd7ca62fad6e0 Mon Sep 17 00:00:00 2001

From: Arne Fitzenreiter <[email protected]>
Date: Wed, 15 Jul 2015 13:54:36 +0200
Subject: libata: add ATA_HORKAGE_NOTRIM

From: Arne Fitzenreiter <[email protected]>

commit 71d126fd28de2d4d9b7b2088dbccd7ca62fad6e0 upstream.

Some devices lose data on TRIM whether queued or not. This patch adds a horkage to disable TRIM.

tj: Collapsed unnecessary if() nesting.

---
 drivers/ata/libata-scsi.c      |    3 ++-
 drivers/ata/libata-transport.c |    2 ++
 include/linux/libata.h         |    2 ++
 3 files changed, 6 insertions(+), 1 deletion(-)
drivers/ata/libata-scsi.c +2 -1
@@ -2568,7 +2568,8 @@ static unsigned int ata_scsiop_read_cap(
 		rbuf[14] = (lowest_aligned >> 8) & 0x3f;
 		rbuf[15] = lowest_aligned;
 
-		if (ata_id_has_trim(args->id)) {
+		if (ata_id_has_trim(args->id) &&
+		    !(dev->horkage & ATA_HORKAGE_NOTRIM)) {
 			rbuf[14] |= 0x80; /* LBPME */
 
 			if (ata_id_has_zero_after_trim(args->id) &&
drivers/ata/libata-transport.c +2 -0
@@ -569,6 +569,8 @@ show_ata_dev_trim(struct device *dev,
 
 	if (!ata_id_has_trim(ata_dev->id))
 		mode = "unsupported";
+	else if (ata_dev->horkage & ATA_HORKAGE_NOTRIM)
+		mode = "forced_unsupported";
 	else if (ata_dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM)
 			mode = "forced_unqueued";
 	else if (ata_fpdma_dsm_supported(ata_dev))
include/linux/libata.h +2 -0
@@ -432,6 +432,8 @@ enum {
 	ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21),	/* some WDs have broken LPM */
 	ATA_HORKAGE_ZERO_AFTER_TRIM = (1 << 22),/* guarantees zero after trim */
 	ATA_HORKAGE_NO_NCQ_LOG	= (1 << 23),	/* don't use NCQ for log read */
+	ATA_HORKAGE_NOTRIM	= (1 << 24),	/* don't use TRIM */
+
 
 	 /* DMA mask for user DMA control: User visible values; DO NOT
 	    renumber */

Patches currently in stable-queue which might be from [email protected] are

queue-4.1/libata-force-disable-trim-for-supersspeed-s238.patch queue-4.1/libata-add-ata_horkage_notrim.patch