Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Mar 2024 15:31:03 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: c849eb8f1925 - main - nullfs: Add the vfs.nullfs.cache_nodes sysctl to control nocache default
Message-ID:  <202403071531.427FV3JI069899@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=c849eb8f1925f95ebfb8dbbe00672d902486a973

commit c849eb8f1925f95ebfb8dbbe00672d902486a973
Author:     Seigo Tanimura <seigo.tanimura@gmail.com>
AuthorDate: 2024-03-04 13:50:25 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-03-07 15:19:18 +0000

    nullfs: Add the vfs.nullfs.cache_nodes sysctl to control nocache default
    
    Differential revision:  https://reviews.freebsd.org/D44217
    MFC after:      1 week
---
 sys/fs/nullfs/null_vfsops.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c
index 2fa592ebbe9c..04a3817a828d 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -46,6 +46,7 @@
 #include <sys/mount.h>
 #include <sys/namei.h>
 #include <sys/proc.h>
+#include <sys/sysctl.h>
 #include <sys/vnode.h>
 #include <sys/jail.h>
 
@@ -63,6 +64,13 @@ static vfs_unmount_t	nullfs_unmount;
 static vfs_vget_t	nullfs_vget;
 static vfs_extattrctl_t	nullfs_extattrctl;
 
+SYSCTL_NODE(_vfs, OID_AUTO, nullfs, CTLFLAG_RW, 0, "nullfs");
+
+static bool null_cache_vnodes = true;
+SYSCTL_BOOL(_vfs_nullfs, OID_AUTO, cache_vnodes, CTLFLAG_RWTUN,
+    &null_cache_vnodes, 0,
+    "cache free nullfs vnodes");
+
 /*
  * Mount null layer
  */
@@ -198,7 +206,8 @@ nullfs_mount(struct mount *mp)
 	}
 
 	xmp->nullm_flags |= NULLM_CACHE;
-	if (vfs_getopt(mp->mnt_optnew, "nocache", NULL, NULL) == 0 ||
+	if (!null_cache_vnodes ||
+	    vfs_getopt(mp->mnt_optnew, "nocache", NULL, NULL) == 0 ||
 	    (xmp->nullm_vfs->mnt_kern_flag & MNTK_NULL_NOCACHE) != 0)
 		xmp->nullm_flags &= ~NULLM_CACHE;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202403071531.427FV3JI069899>