svn commit: r312715 - stable/11/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Tue Jan 24 19:40:36 UTC 2017
Author: mjg
Date: Tue Jan 24 19:40:35 2017
New Revision: 312715
URL: https://svnweb.freebsd.org/changeset/base/312715
Log:
MFC r310983:
vfs: switch nodes_created, recycles_count and free_owe_inact to counter(9)
Modified:
stable/11/sys/kern/vfs_subr.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/kern/vfs_subr.c
==============================================================================
--- stable/11/sys/kern/vfs_subr.c Tue Jan 24 19:39:24 2017 (r312714)
+++ stable/11/sys/kern/vfs_subr.c Tue Jan 24 19:40:35 2017 (r312715)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <sys/buf.h>
#include <sys/condvar.h>
#include <sys/conf.h>
+#include <sys/counter.h>
#include <sys/dirent.h>
#include <sys/event.h>
#include <sys/eventhandler.h>
@@ -123,9 +124,9 @@ static unsigned long numvnodes;
SYSCTL_ULONG(_vfs, OID_AUTO, numvnodes, CTLFLAG_RD, &numvnodes, 0,
"Number of vnodes in existence");
-static u_long vnodes_created;
-SYSCTL_ULONG(_vfs, OID_AUTO, vnodes_created, CTLFLAG_RD, &vnodes_created,
- 0, "Number of vnodes created by getnewvnode");
+static counter_u64_t vnodes_created;
+SYSCTL_COUNTER_U64(_vfs, OID_AUTO, vnodes_created, CTLFLAG_RD, &vnodes_created,
+ "Number of vnodes created by getnewvnode");
/*
* Conversion tables for conversion from vnode types to inode formats
@@ -175,8 +176,8 @@ static u_long freevnodes;
SYSCTL_ULONG(_vfs, OID_AUTO, freevnodes, CTLFLAG_RD,
&freevnodes, 0, "Number of \"free\" vnodes");
-static u_long recycles_count;
-SYSCTL_ULONG(_vfs, OID_AUTO, recycles, CTLFLAG_RD, &recycles_count, 0,
+static counter_u64_t recycles_count;
+SYSCTL_COUNTER_U64(_vfs, OID_AUTO, recycles, CTLFLAG_RD, &recycles_count,
"Number of vnodes recycled to meet vnode cache targets");
/*
@@ -188,8 +189,8 @@ static int reassignbufcalls;
SYSCTL_INT(_vfs, OID_AUTO, reassignbufcalls, CTLFLAG_RW, &reassignbufcalls, 0,
"Number of calls to reassignbuf");
-static u_long free_owe_inact;
-SYSCTL_ULONG(_vfs, OID_AUTO, free_owe_inact, CTLFLAG_RD, &free_owe_inact, 0,
+static counter_u64_t free_owe_inact;
+SYSCTL_COUNTER_U64(_vfs, OID_AUTO, free_owe_inact, CTLFLAG_RD, &free_owe_inact,
"Number of times free vnodes kept on active list due to VFS "
"owing inactivation");
@@ -472,6 +473,11 @@ vntblinit(void *dummy __unused)
NULL, NULL, pctrie_zone_init, NULL, UMA_ALIGN_PTR,
UMA_ZONE_NOFREE | UMA_ZONE_VM);
uma_prealloc(buf_trie_zone, nbuf);
+
+ vnodes_created = counter_u64_alloc(M_WAITOK);
+ recycles_count = counter_u64_alloc(M_WAITOK);
+ free_owe_inact = counter_u64_alloc(M_WAITOK);
+
/*
* Initialize the filesystem syncer.
*/
@@ -918,7 +924,7 @@ vlrureclaim(struct mount *mp, int reclai
}
KASSERT((vp->v_iflag & VI_DOOMED) == 0,
("VI_DOOMED unexpectedly detected in vlrureclaim()"));
- atomic_add_long(&recycles_count, 1);
+ counter_u64_add(recycles_count, 1);
vgonel(vp);
VOP_UNLOCK(vp, 0);
vdropl(vp);
@@ -1217,7 +1223,7 @@ vtryrecycle(struct vnode *vp)
return (EBUSY);
}
if ((vp->v_iflag & VI_DOOMED) == 0) {
- atomic_add_long(&recycles_count, 1);
+ counter_u64_add(recycles_count, 1);
vgonel(vp);
}
VOP_UNLOCK(vp, LK_INTERLOCK);
@@ -1376,7 +1382,7 @@ getnewvnode(const char *tag, struct moun
atomic_add_long(&numvnodes, 1);
mtx_unlock(&vnode_free_list_mtx);
alloc:
- atomic_add_long(&vnodes_created, 1);
+ counter_u64_add(vnodes_created, 1);
vp = (struct vnode *) uma_zalloc(vnode_zone, M_WAITOK);
/*
* Locks are given the generic name "vnode" when created.
@@ -2855,7 +2861,7 @@ _vdrop(struct vnode *vp, bool locked)
vp->v_iflag |= VI_FREE;
mtx_unlock(&vnode_free_list_mtx);
} else {
- atomic_add_long(&free_owe_inact, 1);
+ counter_u64_add(free_owe_inact, 1);
}
VI_UNLOCK(vp);
return;
More information about the svn-src-stable
mailing list