git: e863caad0e74 - stable/13 - vfs: use vnlru_read_freevnodes for the freevnodes sysctl
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 04 Oct 2023 12:08:53 UTC
The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e863caad0e749e0c1b9e18bcb97e52297c71acb7 commit e863caad0e749e0c1b9e18bcb97e52297c71acb7 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2023-09-14 23:53:11 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2023-10-04 12:04:16 +0000 vfs: use vnlru_read_freevnodes for the freevnodes sysctl For a more accurate result. (cherry picked from commit 03bfee175269960c67cab64d761bbb5eb9ac5878) --- sys/kern/vfs_subr.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 04bc26014db7..2fc5c1ef7a91 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -183,8 +183,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; @@ -349,6 +347,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) {