Page MenuHomeFreeBSD

zfs: Emit warning upon use of legacy sysctl
ClosedPublic

Authored by emaste on Oct 10 2025, 8:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 27, 11:09 PM
Unknown Object (File)
Thu, Nov 27, 12:01 AM
Unknown Object (File)
Tue, Nov 25, 7:39 AM
Unknown Object (File)
Tue, Nov 25, 7:30 AM
Unknown Object (File)
Tue, Nov 25, 3:18 AM
Unknown Object (File)
Tue, Nov 25, 2:27 AM
Unknown Object (File)
Fri, Nov 21, 9:59 PM
Unknown Object (File)
Mon, Nov 17, 11:16 AM

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/contrib/openzfs/module/os/freebsd/zfs/sysctl_os.c
754

AFAICT min_auto_ashift/max_auto_ashift did not use arg1/arg2 before, I imagine this was just done without being required.

jlduran added inline comments.
sys/contrib/openzfs/module/os/freebsd/zfs/sysctl_os.c
167

I would rather take an old, new tuple with the full sysctl instead, as it is not a 1:1 translation:

oldnew
vfs.zfs.arc_maxvfs.zfs.arc.max
vfs.zfs.arc_minvfs.zfs.arc.min
vfs.zfs.arc_free_targetvfs.zfs.arc.free_target
vfs.zfs.arc_no_grow_shiftvfs.zfs.arc.no_grow_shift
vfs.zfs.max_auto_ashiftvfs.zfs.vdev.max_auto_ashift
vfs.zfs.min_auto_ashiftvfs.zfs.vdev.min_auto_ashift
sys/contrib/openzfs/module/os/freebsd/zfs/sysctl_os.c
167

Sans vfs.zfs..

Sorry to bother, but I have the following doubt:
There are still a few renamed LEGACY sysctls that were removed (and reverted):

oldnew
vfs.zfs.l2arc_write_maxvfs.zfs.l2arc.write_max
vfs.zfs.l2arc_write_boostvfs.zfs.l2arc.write_boost
vfs.zfs.l2arc_headroomvfs.zfs.l2arc.headroom
vfs.zfs.l2arc_headroom_boostvfs.zfs.l2arc.headroom_boost
vfs.zfs.l2arc_feed_secsvfs.zfs.l2arc.feed_secs
vfs.zfs.l2arc_feed_min_msvfs.zfs.l2arc.feed_min_ms
vfs.zfs.l2arc_noprefetchvfs.zfs.l2arc.noprefetch
vfs.zfs.l2arc_feed_againvfs.zfs.l2arc.feed_again
vfs.zfs.l2arc_norwvfs.zfs.l2arc.norw

There are still a few renamed LEGACY sysctls that were removed (and reverted):

Indeed, unfortunately they're not handled by a SYSCTL_PROC and there's not a convenient/trivial way to add a warning.

SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, l2arc_write_max,
        CTLFLAG_RWTUN, &l2arc_write_max, 0,
        "Max write bytes per interval (LEGACY)");

I could add a SYSCTL_UQUAD wrapper that emits a warning but I didn't think it was worth doing. The auto_ashift sysctl was important to warn on for a few reasons:

  • Setting it has a persistent effect, because it applies for the lifetime of a newly created vdev.
  • The installer set it so it existed on a great number of systems.

In comparison I think the l2arc knobs are tuning parameters that, if legacy names are ignored, may have a performance impact but not a functional or persistent effect.

There are still a few renamed LEGACY sysctls that were removed (and reverted):

Indeed, unfortunately they're not handled by a SYSCTL_PROC and there's not a convenient/trivial way to add a warning.

SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, l2arc_write_max,
        CTLFLAG_RWTUN, &l2arc_write_max, 0,
        "Max write bytes per interval (LEGACY)");

I could add a SYSCTL_UQUAD wrapper that emits a warning but I didn't think it was worth doing. The auto_ashift sysctl was important to warn on for a few reasons:

  • Setting it has a persistent effect, because it applies for the lifetime of a newly created vdev.
  • The installer set it so it existed on a great number of systems.

In comparison I think the l2arc knobs are tuning parameters that, if legacy names are ignored, may have a performance impact but not a functional or persistent effect.

I agree.
It would be ideal if someone from ZFS could review this patch, but in the meantime I'll approve the changes.

This revision is now accepted and ready to land.Oct 16 2025, 3:21 PM

When/if this patch lands, I think I should also land D34598 (in separate chunks) as well.

When/if this patch lands, I think I should also land D34598 (in separate chunks) as well.

Oh yeah, I forgot about that patch. I've just clicked accept on it now.

This revision was automatically updated to reflect the committed changes.

It would be ideal if someone from ZFS could review this patch, but in the meantime I'll approve the changes.

Indeed. I have pushed this now to support the 15.0 release process but would still appreciate post-commit ZFS review.