diff options
author | smh <smh@FreeBSD.org> | 2012-12-13 17:39:07 +0000 |
---|---|---|
committer | smh <smh@FreeBSD.org> | 2012-12-13 17:39:07 +0000 |
commit | c032abecc8b5813f2f21c7db4c03bac389b65344 (patch) | |
tree | 95d73fb38e2ee183d3ff250ad127d9b60ab0a6f2 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c | |
parent | 88b6a40b33f7635a0478e35c2cbcf1ffe60820e9 (diff) | |
download | FreeBSD-src-c032abecc8b5813f2f21c7db4c03bac389b65344.zip FreeBSD-src-c032abecc8b5813f2f21c7db4c03bac389b65344.tar.gz |
Added vfs.zfs.vdev.trim_on_init sysctl which allows full vdev trim on
initialisation to be enabled (1) / disabled (0) defaults to enabled.
This is useful for devices which have a slow trim speed and are either
new or have otherwise already been wiped e.g. secure erase.
PR: kern/173116
Submitted by: Steven Hartland
Approved by: pjd (mentor)
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c index 6cf9106..44f6c67 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c @@ -148,6 +148,11 @@ #include <sys/trim_map.h> #include <sys/fs/zfs.h> +static boolean_t vdev_trim_on_init = B_TRUE; +SYSCTL_DECL(_vfs_zfs_vdev); +SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, trim_on_init, CTLFLAG_RW, + &vdev_trim_on_init, 0, "Enable/disable full vdev trim on initialisation"); + /* * Basic routines to read and write from a vdev label. * Used throughout the rest of this file. @@ -724,7 +729,7 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason) * Don't TRIM if removing so that we don't interfere with zpool * disaster recovery. */ - if (!zfs_notrim && (reason == VDEV_LABEL_CREATE || + if (!zfs_notrim && vdev_trim_on_init && (reason == VDEV_LABEL_CREATE || reason == VDEV_LABEL_SPARE || reason == VDEV_LABEL_L2CACHE)) zio_wait(zio_trim(NULL, spa, vd, 0, vd->vdev_psize)); |