Author: mjg
Date: Sun May 12 06:59:22 2019
New Revision: 347505
URL: https://svnweb.freebsd.org/changeset/base/347505

Log:
  cache: bump numcache on entry, while here fix lnumcache type
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c   Sun May 12 06:42:17 2019        (r347504)
+++ head/sys/kern/vfs_cache.c   Sun May 12 06:59:22 2019        (r347505)
@@ -1632,7 +1632,7 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, 
        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, 
        /*
         * 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, 
                    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);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to