Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934701AbbHLJU0 (ORCPT ); Wed, 12 Aug 2015 05:20:26 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:60839 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934468AbbHLI6O (ORCPT ); Wed, 12 Aug 2015 04:58:14 -0400 From: Luis Henriques To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, kernel-team@lists.ubuntu.com Cc: Arne Fitzenreiter , Tejun Heo , Luis Henriques Subject: [PATCH 3.16.y-ckt 077/118] libata: add ATA_HORKAGE_NOTRIM Date: Wed, 12 Aug 2015 09:56:19 +0100 Message-Id: <1439369820-27005-78-git-send-email-luis.henriques@canonical.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1439369820-27005-1-git-send-email-luis.henriques@canonical.com> References: <1439369820-27005-1-git-send-email-luis.henriques@canonical.com> X-Extended-Stable: 3.16 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2032 Lines: 56 3.16.7-ckt16 -stable review patch. If anyone has any objections, please let me know. ------------------ From: Arne Fitzenreiter 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. Signed-off-by: Arne Fitzenreiter Signed-off-by: Tejun Heo [ luis: backported to 3.16: - dropped changes to show_ata_dev_trim - adjusted context ] Signed-off-by: Luis Henriques --- drivers/ata/libata-scsi.c | 3 ++- include/linux/libata.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 72691fd93948..30af1877fcea 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -2514,7 +2514,8 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf) 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; /* TPE */ if (ata_id_has_zero_after_trim(args->id)) diff --git a/include/linux/libata.h b/include/linux/libata.h index 91aac2525c09..714274450c07 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -429,6 +429,8 @@ enum { ATA_HORKAGE_NO_NCQ_TRIM = (1 << 19), /* don't use queued TRIM */ ATA_HORKAGE_NOLPM = (1 << 20), /* don't use LPM */ ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21), /* some WDs have broken LPM */ + ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */ + /* DMA mask for user DMA control: User visible values; DO NOT renumber */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/