From owner-svn-src-head@FreeBSD.ORG Thu Dec 13 17:39:08 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ADC69C09; Thu, 13 Dec 2012 17:39:08 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 78A128FC08; Thu, 13 Dec 2012 17:39:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBDHd86Z083617; Thu, 13 Dec 2012 17:39:08 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBDHd8RR083616; Thu, 13 Dec 2012 17:39:08 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201212131739.qBDHd8RR083616@svn.freebsd.org> From: Steven Hartland Date: Thu, 13 Dec 2012 17:39:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244188 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Dec 2012 17:39:08 -0000 Author: smh Date: Thu Dec 13 17:39:07 2012 New Revision: 244188 URL: http://svnweb.freebsd.org/changeset/base/244188 Log: 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) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Thu Dec 13 17:06:38 2012 (r244187) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Thu Dec 13 17:39:07 2012 (r244188) @@ -148,6 +148,11 @@ #include #include +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 crt * 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));