Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966106AbcCPIIn (ORCPT ); Wed, 16 Mar 2016 04:08:43 -0400 Received: from mail.kernel.org ([198.145.29.136]:59409 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965249AbcCPIIh (ORCPT ); Wed, 16 Mar 2016 04:08:37 -0400 From: lizf@kernel.org To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Arne Fitzenreiter , Tejun Heo , Zefan Li Subject: [PATCH 3.4 026/107] libata: add ATA_HORKAGE_NOTRIM Date: Wed, 16 Mar 2016 16:05:20 +0800 Message-Id: <1458115601-5762-26-git-send-email-lizf@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1458115541-5712-1-git-send-email-lizf@kernel.org> References: <1458115541-5712-1-git-send-email-lizf@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1745 Lines: 54 From: Arne Fitzenreiter 3.4.111-rc1 review patch. If anyone has any objections, please let me know. ------------------ 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 [lizf: Backported to 3.4: - adjust context - drop changes to show_ata_dev_trim()] Signed-off-by: Zefan Li --- 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 15863a4..94ccbc1 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -2461,7 +2461,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 35e7f71..9736dbe 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -402,6 +402,8 @@ enum { ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */ ATA_HORKAGE_DUMP_ID = (1 << 16), /* dump IDENTIFY data */ ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17), /* Set max sects to 65535 */ + ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */ + /* DMA mask for user DMA control: User visible values; DO NOT renumber */ -- 1.9.1