vfs: use vnlru_read_freevnodes for the freevnodes sysctl

For a more accurate result.
This commit is contained in:
Mateusz Guzik 2023-09-14 23:53:11 +00:00
parent ba5dc166e0
commit 03bfee1752

View file

@ -184,8 +184,6 @@ static struct vnode *vnode_list_reclaim_marker;
*/
static long wantfreevnodes;
static long __exclusive_cache_line freevnodes;
SYSCTL_ULONG(_vfs, OID_AUTO, freevnodes, CTLFLAG_RD,
&freevnodes, 0, "Number of \"free\" vnodes");
static long freevnodes_old;
static counter_u64_t recycles_count;
@ -350,6 +348,19 @@ SYSCTL_PROC(_kern, KERN_MAXVNODES, maxvnodes,
CTLTYPE_ULONG | CTLFLAG_MPSAFE | CTLFLAG_RW, NULL, 0, sysctl_maxvnodes,
"LU", "Target for maximum number of vnodes");
static int
sysctl_freevnodes(SYSCTL_HANDLER_ARGS)
{
u_long rfreevnodes;
rfreevnodes = vnlru_read_freevnodes();
return (sysctl_handle_long(oidp, &rfreevnodes, 0, req));
}
SYSCTL_PROC(_vfs, OID_AUTO, freevnodes,
CTLTYPE_ULONG | CTLFLAG_MPSAFE | CTLFLAG_RD, NULL, 0, sysctl_freevnodes,
"LU", "Number of \"free\" vnodes");
static int
sysctl_wantfreevnodes(SYSCTL_HANDLER_ARGS)
{