summaryrefslogtreecommitdiff
path: root/usr/src/uts/common
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/common')
-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 */