summaryrefslogtreecommitdiff
path: root/usr/src/uts
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2019-12-19 12:40:51 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2019-12-19 12:40:51 +0000
commit1b4b6f23c2256de6934b89b05c0a77a44b84f817 (patch)
tree38a41ef900c089f777207f357f041d5814dfd532 /usr/src/uts
parentdfbd50d8db03bb9bc7350af3a750cd017d66d0c0 (diff)
parent7b2eb3f3c068e560c7357b0f314172448bb8d1e0 (diff)
downloadillumos-joyent-1b4b6f23c2256de6934b89b05c0a77a44b84f817.tar.gz
[illumos-gate merge]
commit 7b2eb3f3c068e560c7357b0f314172448bb8d1e0 12057 Writing part of the string to stderr makes zlogin exit commit d2dd27964b9dfc03118548f9509e4706787c2a69 12088 Cannot build iasl with bison 3.5 [-Werror=char-subscripts] commit bf74bfd433cc5106d2fffc63678efb6ba4a3694c 12090 loader.efi: efi_readkey_ex needs to check the key despite the shift status or toggle status commit 5947648b7f5c085635051e1f7aa083a309542467 12069 Backport sh_delay() and tvsleep() from ksh-2020.0.0 commit fc5c75cf5edb072564020725faa0c4313714f09f 12051 re-enable ZFS trim by default commit 8b35e52344673c75ba6a446ced1fb5c36b52a242 12070 sata SSDs attached to sata ports can't trim commit 2ed5f78a049996104f9dcce38d0c0c1735dd0e7a 12091 loader: biosdisk.c: Use symbolic names for int13 calls commit bf6cb86ec437546144857d9aa94ef222ec6763c0 12082 libpctx: cast between incompatible function types commit c94f4b0313ed735fc39e1b15e1fa48c0e6e3730f 12081 libldap5: cast between incompatible function types commit 3c19a1689122901345a6089d081aa2de4a1096da 12079 audit_plugins: cast between incompatible function types commit adbb29bd77dbfbbf129b5e3bd6ccc5bd4074fd79 12073 loader: devopen dereference after free commit fdf04373777e703cebbbce0f774ae970eb6030f7 12072 loader: vdisk dereference after free
Diffstat (limited to 'usr/src/uts')
-rw-r--r--usr/src/uts/common/fs/zfs/vdev_disk.c4
-rw-r--r--usr/src/uts/common/io/sata/impl/sata.c26
-rw-r--r--usr/src/uts/common/sys/sata/sata_defs.h4
3 files changed, 23 insertions, 11 deletions
diff --git a/usr/src/uts/common/fs/zfs/vdev_disk.c b/usr/src/uts/common/fs/zfs/vdev_disk.c
index c674dbf811..20df3f306b 100644
--- a/usr/src/uts/common/fs/zfs/vdev_disk.c
+++ b/usr/src/uts/common/fs/zfs/vdev_disk.c
@@ -40,9 +40,9 @@
#include <sys/fm/fs/zfs.h>
/*
- * Tunable to enable TRIM, which is temporarily disabled by default.
+ * Tunable to disable TRIM in case we're using a problematic SSD.
*/
-uint_t zfs_no_trim = 1;
+uint_t zfs_no_trim = 0;
/*
* Tunable parameter for debugging or performance analysis. Setting this
diff --git a/usr/src/uts/common/io/sata/impl/sata.c b/usr/src/uts/common/io/sata/impl/sata.c
index 617aa8ea5a..e9279025e1 100644
--- a/usr/src/uts/common/io/sata/impl/sata.c
+++ b/usr/src/uts/common/io/sata/impl/sata.c
@@ -25,7 +25,7 @@
/*
* Copyright 2017 Nexenta Systems, Inc. All rights reserved.
* Copyright 2016 Argo Technologies SA
- * Copyright (c) 2018, Joyent, Inc.
+ * Copyright 2019 Joyent, Inc.
*/
/*
@@ -4759,17 +4759,25 @@ sata_txlt_read_capacity16(sata_pkt_txlate_t *spx)
/* logical blocks per physical block exponent */
rbuf[13] = l2p_exp;
- /* lowest aligned logical block address = 0 (for now) */
- /* tpe and tprz as defined in T10/10-079 r0 */
- if (sdinfo->satadrv_id.ai_addsupported &
- SATA_DETERMINISTIC_READ) {
- if (sdinfo->satadrv_id.ai_addsupported &
- SATA_READ_ZERO) {
+ /*
+ * tpe and tprz as defined in T10/10-079 r0.
+ * TRIM support is indicated by the relevant bit in the data
+ * set management word. Read-after-trim behavior is indicated
+ * by the additional bits in the identify device word. Of the
+ * three defined possibilities, we only flag read-zero.
+ */
+ if (sdinfo->satadrv_id.ai_dsm & SATA_DSM_TRIM) {
+ rbuf[14] |= TPE;
+
+ if ((sdinfo->satadrv_id.ai_addsupported &
+ SATA_DETERMINISTIC_READ) &&
+ (sdinfo->satadrv_id.ai_addsupported &
+ SATA_READ_ZERO)) {
rbuf[14] |= TPRZ;
- } else {
- rbuf[14] |= TPE;
}
}
+
+ /* lowest aligned logical block address = 0 (for now) */
/* rbuf[15] = 0; */
scsipkt->pkt_state |= STATE_XFERRED_DATA;
diff --git a/usr/src/uts/common/sys/sata/sata_defs.h b/usr/src/uts/common/sys/sata/sata_defs.h
index 049b42d60c..f3a3a1d481 100644
--- a/usr/src/uts/common/sys/sata/sata_defs.h
+++ b/usr/src/uts/common/sys/sata/sata_defs.h
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2019 Joyent, Inc.
*/
#ifndef _SATA_DEFS_H
@@ -344,6 +345,9 @@ typedef struct sata_id {
#define SATA_UDMA_SUP_MASK 0x007f /* UDMA modes supported */
#define SATA_UDMA_SEL_MASK 0x7f00 /* UDMA modes selected */
+/* Data Set Management: word 169 */
+#define SATA_DSM_TRIM 0x0001 /* Set when TRIM is supported */
+
/* Identify Device: command set supported/enabled bits - word 206 */
/* All are SCT Command Transport support */