All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Arne Fitzenreiter <arne_f@ipfire.org>
To: tj@kernel.org
Cc: linux-ide@vger.kernel.org, Arne Fitzenreiter <arne_f@ipfire.org>
Subject: [PATCH 1/2] libata: add ATA_HORKAGE_NOTRIM
Date: Tue, 14 Jul 2015 13:28:33 +0200	[thread overview]
Message-ID: <1436873314-22563-2-git-send-email-arne_f@ipfire.org> (raw)
In-Reply-To: <1436873314-22563-1-git-send-email-arne_f@ipfire.org>

sone disks lose data at trim also with disabled ncq
so this add a switch to force disable trim.
---
 drivers/ata/libata-scsi.c      | 14 ++++++++------
 drivers/ata/libata-transport.c |  2 ++
 include/linux/libata.h         |  2 ++
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 3131adc..cc80e4d 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2569,12 +2569,14 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
 		rbuf[15] = lowest_aligned;
 
 		if (ata_id_has_trim(args->id)) {
-			rbuf[14] |= 0x80; /* LBPME */
-
-			if (ata_id_has_zero_after_trim(args->id) &&
-			    dev->horkage & ATA_HORKAGE_ZERO_AFTER_TRIM) {
-				ata_dev_info(dev, "Enabling discard_zeroes_data\n");
-				rbuf[14] |= 0x40; /* LBPRZ */
+			if (!(dev->horkage & ATA_HORKAGE_NOTRIM)) {
+				rbuf[14] |= 0x80; /* LBPME */
+
+				if (ata_id_has_zero_after_trim(args->id) &&
+				    dev->horkage & ATA_HORKAGE_ZERO_AFTER_TRIM) {
+					ata_dev_info(dev, "Enabling discard_zeroes_data\n");
+					rbuf[14] |= 0x40; /* LBPRZ */
+				}
 			}
 		}
 	}
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
index d6c37bc..3a13c7d 100644
--- a/drivers/ata/libata-transport.c
+++ b/drivers/ata/libata-transport.c
@@ -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))
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 36ce37b..5c8bac6 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -431,6 +431,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 */
-- 
2.4.4


  reply	other threads:[~2015-07-14 11:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14 11:28 [PATCH 0/2] disable trim for SuperSSpeed S238 SSD Arne Fitzenreiter
2015-07-14 11:28 ` Arne Fitzenreiter [this message]
2015-07-14 11:43   ` [PATCH 1/2] libata: add ATA_HORKAGE_NOTRIM Sergei Shtylyov
2015-07-14 12:16     ` arne_f
2015-07-14 12:34       ` Sergei Shtylyov
2015-07-14 18:50   ` Tejun Heo
2015-07-14 11:28 ` [PATCH 2/2] libata: force disable trim for SuperSSpeed S238 Arne Fitzenreiter
2015-07-14 18:54   ` Tejun Heo
  -- strict thread matches above, loose matches on Subject: below --
2015-07-14 13:01 [PATCH 0/2] disable trim for SuperSSpeed S238 SSD - v2 Arne Fitzenreiter
2015-07-14 13:01 ` [PATCH 1/2] libata: add ATA_HORKAGE_NOTRIM Arne Fitzenreiter
2015-07-15 11:54 [PATCH 0/2] disable trim for SuperSSpeed S238 SSD - v3 Arne Fitzenreiter
2015-07-15 11:54 ` [PATCH 1/2] libata: add ATA_HORKAGE_NOTRIM Arne Fitzenreiter
2015-07-15 14:26   ` Greg KH
2015-07-15 15:25   ` Tejun Heo
2015-07-15 17:23   ` Sergei Shtylyov
2015-07-15 17:53     ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436873314-22563-2-git-send-email-arne_f@ipfire.org \
    --to=arne_f@ipfire.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.