Skip RAW kstat sysctls by default

hese kstats are often expensive to compute so we want to avoid them
unless specifically requested.

The following kstats are affected by this change:

kstat.zfs.${pool}.multihost
kstat.zfs.${pool}.misc.state
kstat.zfs.${pool}.txgs
kstat.zfs.misc.fletcher_4_bench
kstat.zfs.misc.vdev_raidz_bench
kstat.zfs.misc.dbufs
kstat.zfs.misc.dbgmsg

PR:		249258
Reported by:	mjg
Reviewed by:	mjg, allanjude
Obtained from:	https://github.com/openzfs/zfs/pull/11099
Sponsored by:	iXsystems, Inc.
This commit is contained in:
Ryan Moeller 2020-10-24 16:25:52 +00:00
parent e58483c4fb
commit b19cdab345

View File

@ -475,14 +475,14 @@ kstat_install(kstat_t *ksp)
if (ksp->ks_raw_ops.data) { if (ksp->ks_raw_ops.data) {
root = SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx, root = SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
SYSCTL_CHILDREN(ksp->ks_sysctl_root), SYSCTL_CHILDREN(ksp->ks_sysctl_root),
OID_AUTO, ksp->ks_name, OID_AUTO, ksp->ks_name, CTLTYPE_STRING | CTLFLAG_RD
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, | CTLFLAG_MPSAFE | CTLFLAG_SKIP,
ksp, 0, kstat_sysctl_raw, "A", ksp->ks_name); ksp, 0, kstat_sysctl_raw, "A", ksp->ks_name);
} else { } else {
root = SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx, root = SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
SYSCTL_CHILDREN(ksp->ks_sysctl_root), SYSCTL_CHILDREN(ksp->ks_sysctl_root),
OID_AUTO, ksp->ks_name, OID_AUTO, ksp->ks_name, CTLTYPE_OPAQUE | CTLFLAG_RD
CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, | CTLFLAG_MPSAFE | CTLFLAG_SKIP,
ksp, 0, kstat_sysctl_raw, "", ksp->ks_name); ksp, 0, kstat_sysctl_raw, "", ksp->ks_name);
} }
break; break;