]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/linux-3.14.43_SuperSSpeed_NOTRIM.patch
kernel: fix trim dataloss on some solid state discs
[ipfire-2.x.git] / src / patches / linux-3.14.43_SuperSSpeed_NOTRIM.patch
1 diff -Naur linux-3.14.43.org/drivers/ata/libata-core.c linux-3.14.43/drivers/ata/libata-core.c
2 --- linux-3.14.43.org/drivers/ata/libata-core.c 2015-05-17 18:54:01.000000000 +0200
3 +++ linux-3.14.43/drivers/ata/libata-core.c 2015-07-11 19:15:01.450041507 +0200
4 @@ -4229,6 +4229,9 @@
5 { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },
6 { "Crucial_CT*M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },
7
8 + /* devices that don't properly handle TRIM commands */
9 + { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, },
10 +
11 /*
12 * Some WD SATA-I drives spin up and down erratically when the link
13 * is put into the slumber mode. We don't have full list of the
14 diff -Naur linux-3.14.43.org/drivers/ata/libata-scsi.c linux-3.14.43/drivers/ata/libata-scsi.c
15 --- linux-3.14.43.org/drivers/ata/libata-scsi.c 2015-05-17 18:54:01.000000000 +0200
16 +++ linux-3.14.43/drivers/ata/libata-scsi.c 2015-07-11 20:47:22.570021716 +0200
17 @@ -2510,11 +2513,15 @@
18 rbuf[14] = (lowest_aligned >> 8) & 0x3f;
19 rbuf[15] = lowest_aligned;
20
21 - if (ata_id_has_trim(args->id)) {
22 - rbuf[14] |= 0x80; /* TPE */
23
24 - if (ata_id_has_zero_after_trim(args->id))
25 - rbuf[14] |= 0x40; /* TPRZ */
26 +
27 + if (!(dev->horkage & ATA_HORKAGE_NOTRIM)) {
28 + if (ata_id_has_trim(args->id)) {
29 + rbuf[14] |= 0x80; /* TPE */
30 +
31 + if (ata_id_has_zero_after_trim(args->id))
32 + rbuf[14] |= 0x40; /* TPRZ */
33 + }
34 }
35 }
36
37 diff -Naur linux-3.14.43.org/include/linux/libata.h linux-3.14.43/include/linux/libata.h
38 --- linux-3.14.43.org/include/linux/libata.h 2015-05-17 18:54:01.000000000 +0200
39 +++ linux-3.14.43/include/linux/libata.h 2015-07-11 19:13:03.190682173 +0200
40 @@ -421,6 +421,7 @@
41 ATA_HORKAGE_NO_NCQ_TRIM = (1 << 19), /* don't use queued TRIM */
42 ATA_HORKAGE_NOLPM = (1 << 20), /* don't use LPM */
43 ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21), /* some WDs have broken LPM */
44 + ATA_HORKAGE_NOTRIM = (1 << 22), /* don't use TRIM */
45
46 /* DMA mask for user DMA control: User visible values; DO NOT
47 renumber */