svn commit: r325458 - head/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Sun Nov 5 22:29:47 UTC 2017
Author: mjg
Date: Sun Nov 5 22:29:45 2017
New Revision: 325458
URL: https://svnweb.freebsd.org/changeset/base/325458
Log:
namecache: bump numcache after dropping all locks
This makes no difference correctness-wise, but shortens total hold time.
Modified:
head/sys/kern/vfs_cache.c
Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c Sun Nov 5 22:29:34 2017 (r325457)
+++ head/sys/kern/vfs_cache.c Sun Nov 5 22:29:45 2017 (r325458)
@@ -1606,6 +1606,7 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp,
int flag;
int len;
bool neg_locked;
+ int lnumcache;
CTR3(KTR_VFS, "cache_enter(%p, %p, %s)", dvp, vp, cnp->cn_nameptr);
VNASSERT(vp == NULL || (vp->v_iflag & VI_DOOMED) == 0, vp,
@@ -1745,7 +1746,6 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp,
dvp->v_cache_dd = ncp;
}
- atomic_add_rel_long(&numcache, 1);
if (vp != NULL) {
if (vp->v_type == VDIR) {
if (flag != NCF_ISDOTDOT) {
@@ -1798,7 +1798,8 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp,
ncp->nc_name);
}
cache_enter_unlock(&cel);
- if (numneg * ncnegfactor > numcache)
+ lnumcache = atomic_fetchadd_long(&numcache, 1) + 1;
+ if (numneg * ncnegfactor > lnumcache)
cache_negative_zap_one();
cache_free(ndd);
return;
More information about the svn-src-head
mailing list