aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2015-01-08 10:34:27 -0500
committerTejun Heo <tj@kernel.org>2015-01-08 10:35:40 -0500
commite61f7d1c3c07a7e51036b0796749edb00deff845 (patch)
tree1cd3602657c2402561793540e890f3f16b2bab7f /drivers/ata
parent4aaa71873ddb9faf4b0c4826579e2f6d18ff9ab4 (diff)
libata: Whitelist SSDs that are known to properly return zeroes after TRIM
As defined, the DRAT (Deterministic Read After Trim) and RZAT (Return Zero After Trim) flags in the ATA Command Set are unreliable in the sense that they only define what happens if the device successfully executed the DSM TRIM command. TRIM is only advisory, however, and the device is free to silently ignore all or parts of the request. In practice this renders the DRAT and RZAT flags completely useless and because the results are unpredictable we decided to disable discard in MD for 3.18 to avoid the risk of data corruption. Hardware vendors in the real world obviously need better guarantees than what the standards bodies provide. Unfortuntely those guarantees are encoded in product requirements documents rather than somewhere we can key off of them programatically. So we are compelled to disabling discard_zeroes_data for all devices unless we explicitly have data to support whitelisting them. This patch whitelists SSDs from a few of the main vendors. None of the whitelists are based on written guarantees. They are purely based on empirical evidence collected from internal and external users that have tested or qualified these drives in RAID deployments. The whitelist is only meant as a starting point and is by no means comprehensive: - All intel SSD models except for 510 - Micron M5?0/M600 - Samsung SSDs - Seagate SSDs Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/libata-core.c31
-rw-r--r--drivers/ata/libata-scsi.c10
2 files changed, 33 insertions, 8 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 5c84fb5c3372..23c2ae03a7ab 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4233,10 +4233,33 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
4233 { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, 4233 { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER },
4234 4234
4235 /* devices that don't properly handle queued TRIM commands */ 4235 /* devices that don't properly handle queued TRIM commands */
4236 { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, 4236 { "Micron_M[56]*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
4237 { "Crucial_CT???M500SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, 4237 ATA_HORKAGE_ZERO_AFTER_TRIM, },
4238 { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, 4238 { "Crucial_CT*SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },
4239 { "Crucial_CT*M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, 4239
4240 /*
4241 * As defined, the DRAT (Deterministic Read After Trim) and RZAT
4242 * (Return Zero After Trim) flags in the ATA Command Set are
4243 * unreliable in the sense that they only define what happens if
4244 * the device successfully executed the DSM TRIM command. TRIM
4245 * is only advisory, however, and the device is free to silently
4246 * ignore all or parts of the request.
4247 *
4248 * Whitelist drives that are known to reliably return zeroes
4249 * after TRIM.
4250 */
4251
4252 /*
4253 * The intel 510 drive has buggy DRAT/RZAT. Explicitly exclude
4254 * that model before whitelisting all other intel SSDs.
4255 */
4256 { "INTEL*SSDSC2MH*", NULL, 0, },
4257
4258 { "INTEL*SSD*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, },
4259 { "SSD*INTEL*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, },
4260 { "Samsung*SSD*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, },
4261 { "SAMSUNG*SSD*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, },
4262 { "ST[1248][0248]0[FH]*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, },
4240 4263
4241 /* 4264 /*
4242 * Some WD SATA-I drives spin up and down erratically when the link 4265 * Some WD SATA-I drives spin up and down erratically when the link
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index e364e86e84d7..6abd17a85b13 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2532,13 +2532,15 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
2532 rbuf[15] = lowest_aligned; 2532 rbuf[15] = lowest_aligned;
2533 2533
2534 if (ata_id_has_trim(args->id)) { 2534 if (ata_id_has_trim(args->id)) {
2535 rbuf[14] |= 0x80; /* TPE */ 2535 rbuf[14] |= 0x80; /* LBPME */
2536 2536
2537 if (ata_id_has_zero_after_trim(args->id)) 2537 if (ata_id_has_zero_after_trim(args->id) &&
2538 rbuf[14] |= 0x40; /* TPRZ */ 2538 dev->horkage & ATA_HORKAGE_ZERO_AFTER_TRIM) {
2539 ata_dev_info(dev, "Enabling discard_zeroes_data\n");
2540 rbuf[14] |= 0x40; /* LBPRZ */
2541 }
2539 } 2542 }
2540 } 2543 }
2541
2542 return 0; 2544 return 0;
2543} 2545}
2544 2546