aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2019-05-12 06:59:22 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2019-05-12 06:59:22 +0000
commit5bf50787e6308014847cb90e07b53a1b0f8abd15 (patch)
tree7232909d0556b67e698a6e1a19b87be60567d4c4 /sys
parent45372f1a6f7a43d235b083e51c9265574201ad26 (diff)
downloadsrc-5bf50787e6308014847cb90e07b53a1b0f8abd15.tar.gz
src-5bf50787e6308014847cb90e07b53a1b0f8abd15.zip
cache: bump numcache on entry, while here fix lnumcache type
Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/head/; revision=347505
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_cache.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 940087492350..a515f4e9739d 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -1632,7 +1632,7 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp,
int flag;
int len;
bool neg_locked;
- int lnumcache;
+ u_long lnumcache;
CTR3(KTR_VFS, "cache_enter(%p, %p, %s)", dvp, vp, cnp->cn_nameptr);
VNASSERT(vp == NULL || (vp->v_iflag & VI_DOOMED) == 0, vp,
@@ -1646,7 +1646,8 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp,
/*
* Avoid blowout in namecache entries.
*/
- if (__predict_false(numcache >= desiredvnodes * ncsizefactor))
+ lnumcache = atomic_fetchadd_long(&numcache, 1) + 1;
+ if (__predict_false(lnumcache >= desiredvnodes * ncsizefactor))
return;
cache_celockstate_init(&cel);
@@ -1825,7 +1826,6 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp,
ncp->nc_name);
}
cache_enter_unlock(&cel);
- lnumcache = atomic_fetchadd_long(&numcache, 1) + 1;
if (numneg * ncnegfactor > lnumcache)
cache_negative_zap_one();
cache_free(ndd);