Commit e8a45305 authored by Arne Fitzenreiter's avatar Arne Fitzenreiter Committed by Kamal Mostafa

libata: add ATA_HORKAGE_NOTRIM

commit 71d126fd 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: default avatarArne Fitzenreiter <arne_f@ipfire.org>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
[ kamal: backport to 3.19-stable: no show_ata_dev_trim(); context ]
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent c7a30002
...@@ -2531,7 +2531,8 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf) ...@@ -2531,7 +2531,8 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
rbuf[14] = (lowest_aligned >> 8) & 0x3f; rbuf[14] = (lowest_aligned >> 8) & 0x3f;
rbuf[15] = lowest_aligned; 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 */ rbuf[14] |= 0x80; /* LBPME */
if (ata_id_has_zero_after_trim(args->id) && if (ata_id_has_zero_after_trim(args->id) &&
......
...@@ -431,6 +431,8 @@ enum { ...@@ -431,6 +431,8 @@ enum {
ATA_HORKAGE_NOLPM = (1 << 20), /* don't use LPM */ ATA_HORKAGE_NOLPM = (1 << 20), /* don't use LPM */
ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21), /* some WDs have broken LPM */ 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_ZERO_AFTER_TRIM = (1 << 22),/* guarantees zero after trim */
ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */
/* DMA mask for user DMA control: User visible values; DO NOT /* DMA mask for user DMA control: User visible values; DO NOT
renumber */ renumber */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment