diff options
author | Arne Fitzenreiter <arne_f@ipfire.org> | 2015-07-15 13:54:36 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-08-03 09:29:45 -0700 |
commit | 143482d1d9a077c5bef978f3c97d3790d8946d27 (patch) | |
tree | 02c7b13b12d7d5dd536c1468f75e19f036e9593f | |
parent | 8f24d7c7cccae54f6025206479f5d54f35c65519 (diff) | |
download | linux-stable-143482d1d9a077c5bef978f3c97d3790d8946d27.tar.gz linux-stable-143482d1d9a077c5bef978f3c97d3790d8946d27.tar.bz2 linux-stable-143482d1d9a077c5bef978f3c97d3790d8946d27.zip |
libata: add ATA_HORKAGE_NOTRIM
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 <arne_f@ipfire.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/ata/libata-scsi.c | 3 | ||||
-rw-r--r-- | include/linux/libata.h | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 9933b4db7caf..04e7db668362 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -2512,7 +2512,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 8e5d45fa83cf..8ad0771b88ab 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -409,6 +409,7 @@ enum { ATA_HORKAGE_ATAPI_DMADIR = (1 << 18), /* device requires dmadir */ 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 */ |