Page MenuHomeFreeBSD

kern/nullfs: Add the sysctl to control the vnode caching upon mounting nullfs.
ClosedPublic

Authored by seigo.tanimura_gmail.com on Mar 5 2024, 6:31 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, May 5, 12:57 AM
Unknown Object (File)
Sat, May 4, 1:19 PM
Unknown Object (File)
Tue, Apr 30, 5:53 AM
Unknown Object (File)
Mon, Apr 29, 7:33 AM
Unknown Object (File)
Fri, Apr 26, 3:55 AM
Unknown Object (File)
Sat, Apr 20, 2:02 PM
Unknown Object (File)
Sat, Apr 20, 2:01 PM
Unknown Object (File)
Sun, Apr 14, 5:45 PM
Subscribers

Details

Summary

This is an alternative solution to recycle the nullfs vnodes not in use.

  • New sysctl OID
  • vfs.nullfs.cache_nodes If true (default), a newly mounted nullfs filesystem caches its vnodes after finishing their uses. (0 == v_usecount) If false, a newly mounted nullfs filesystem recycles its vnodes immediately upon finishing their uses. The configuration affects the vnodes in the newly mounted nullfs filesystems only. The vnodes in the nullfs filesystems already mounted are not affected. (NB nullfs does not support updating the mount options.)

Based on: https://reviews.freebsd.org/D44177
Security: FreeBSD-EN-23:18.openzfs
Signed-off-by: Seigo Tanimura <seigo.tanimura@gmail.com>

Diff Detail

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

Event Timeline

Target branches: main, stable/14, releng/14.0
Revised diff of: https://reviews.freebsd.org/D44177

Unlike https://reviews.freebsd.org/D44177, this fix does not depend on the ZFS fix and can be merged independently from it.

This fix has been confirmed to achieve the same effect as https://reviews.freebsd.org/D44177.

I will soon close https://reviews.freebsd.org/D44177 and https://reviews.freebsd.org/D44178 to supersede the changes.

sys/fs/nullfs/null_subr.c
69 ↗(On Diff #135393)

Move these declarations to null_vfsops.c

sys/fs/nullfs/null_vfsops.c
70

cache_vnodes, not nodes

71

continuation line should use +4 spaces, not tab, for indent.

214

The patch should add null_cache_nodes to the if expression, without wrapping it.

sys/fs/nullfs/null_vfsops.c
50

Put sys/sysctl.h before sys/vnode.h, alphabetically.

67

This declaration should not be needed, it is provided by sys/sysctl.h

102

I disagree with this comment. The sysctl really about default settings for new mounts. It should and in fact cannot change mode of the running mounts.

Best is to drop this comment addition.

Please send me the patch in the format of 'git format-patch' with metadata filled. Most important, please specify the author as you want to appear in the vcs history.

This revision is now accepted and ready to land.Mar 6 2024, 7:59 AM