diff options
author | mav <mav@FreeBSD.org> | 2016-03-20 19:11:17 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2016-03-20 19:11:17 +0000 |
commit | 47960737914aae06c000a0a9c9729a465d501e95 (patch) | |
tree | 0eadf84e95faec5a0965ef97f5ee1349d28fd846 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c | |
parent | c2202a0e09694a7f217d53907c67fe5c2c950e17 (diff) | |
download | FreeBSD-src-47960737914aae06c000a0a9c9729a465d501e95.zip FreeBSD-src-47960737914aae06c000a0a9c9729a465d501e95.tar.gz |
MFC r271788 (by will):
Enable ZFS debug flags to be modified via vfs.zfs.debug_flags.
This is primarily only of interest to ZFS developers, but it makes it
easier to get additional debugging.
MFSpectraBSD: 517074 on 2011/12/15 (by will), 662343 on 2013/03/20 (by gibbs)
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c index e18ffd2..924f012 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c @@ -263,6 +263,33 @@ TUNABLE_INT("vfs.zfs.recover", &zfs_recover); SYSCTL_INT(_vfs_zfs, OID_AUTO, recover, CTLFLAG_RWTUN, &zfs_recover, 0, "Try to recover from otherwise-fatal errors."); +static int +sysctl_vfs_zfs_debug_flags(SYSCTL_HANDLER_ARGS) +{ + int err, val; + + val = zfs_flags; + err = sysctl_handle_int(oidp, &val, 0, req); + if (err != 0 || req->newptr == NULL) + return (err); + + /* + * ZFS_DEBUG_MODIFY must be enabled prior to boot so all + * arc buffers in the system have the necessary additional + * checksum data. However, it is safe to disable at any + * time. + */ + if (!(zfs_flags & ZFS_DEBUG_MODIFY)) + val &= ~ZFS_DEBUG_MODIFY; + zfs_flags = val; + + return (0); +} +TUNABLE_INT("vfs.zfs.debug_flags", &zfs_flags); +SYSCTL_PROC(_vfs_zfs, OID_AUTO, debug_flags, + CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, sizeof(int), + sysctl_vfs_zfs_debug_flags, "IU", "Debug flags for ZFS testing."); + /* * If destroy encounters an EIO while reading metadata (e.g. indirect * blocks), space referenced by the missing metadata can not be freed. |