Commit 71d126fd authored by Arne Fitzenreiter's avatar Arne Fitzenreiter Committed by Tejun Heo

libata: add ATA_HORKAGE_NOTRIM

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>
Cc: stable@vger.kernel.org
parent 08c85d2a
...@@ -2568,7 +2568,8 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf) ...@@ -2568,7 +2568,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) &&
......
...@@ -569,6 +569,8 @@ show_ata_dev_trim(struct device *dev, ...@@ -569,6 +569,8 @@ show_ata_dev_trim(struct device *dev,
if (!ata_id_has_trim(ata_dev->id)) if (!ata_id_has_trim(ata_dev->id))
mode = "unsupported"; mode = "unsupported";
else if (ata_dev->horkage & ATA_HORKAGE_NOTRIM)
mode = "forced_unsupported";
else if (ata_dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM) else if (ata_dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM)
mode = "forced_unqueued"; mode = "forced_unqueued";
else if (ata_fpdma_dsm_supported(ata_dev)) else if (ata_fpdma_dsm_supported(ata_dev))
......
...@@ -431,6 +431,8 @@ enum { ...@@ -431,6 +431,8 @@ enum {
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_NO_NCQ_LOG = (1 << 23), /* don't use NCQ for log read */ 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 /* 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