kern/173116: Add sysctl to enable / disable ZFS device full trim on init (patch included)
Steven Hartland
steven.hartland at multiplay.co.uk
Fri Oct 26 08:50:02 UTC 2012
>Number: 173116
>Category: kern
>Synopsis: Add sysctl to enable / disable ZFS device full trim on init (patch included)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Oct 26 08:50:02 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Steven Hartland
>Release: 8.3-RELEASE
>Organization:
Multiplay
>Environment:
FreeBSD dev 8.3-RELEASE-p4 FreeBSD 8.3-RELEASE-p4 #22: Mon Sep 17 17:18:32 UTC 2012 root at dev:/usr/obj/usr/src/sys/MULTIPLAY amd64
>Description:
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.
>How-To-Repeat:
N/A
>Fix:
Apply the attached patch
Patch attached with submission follows:
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.
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c.orig 2012-10-25 19:30:49.281472955 +0000
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c 2012-10-25 19:45:31.538099840 +0000
@@ -144,6 +144,11 @@
#include <sys/trim_map.h>
#include <sys/fs/zfs.h>
+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.
@@ -699,7 +704,7 @@
* 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));
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list