Date: Sun, 13 Dec 2020 21:29:39 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368615 - head/sys/kern Message-ID: <202012132129.0BDLTdq0007912@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Sun Dec 13 21:29:39 2020 New Revision: 368615 URL: https://svnweb.freebsd.org/changeset/base/368615 Log: cache: fix ups bad predicts - last level fallback normally sees CREATE; the code should be optimized to not get there for said case - fast path commonly fails with ENOENT Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sun Dec 13 21:28:15 2020 (r368614) +++ head/sys/kern/vfs_cache.c Sun Dec 13 21:29:39 2020 (r368615) @@ -1824,7 +1824,10 @@ retry: } return (-1); negative_success: - if (__predict_false(cnp->cn_nameiop == CREATE)) { + /* + * We don't get here with regular lookup apart from corner cases. + */ + if (__predict_true(cnp->cn_nameiop == CREATE)) { if (cnp->cn_flags & ISLASTCN) { counter_u64_add(numnegzaps, 1); error = cache_zap_locked_bucket(ncp, cnp, hash, blp); @@ -1927,7 +1930,7 @@ cache_lookup(struct vnode *dvp, struct vnode **vpp, st } return (-1); negative_success: - if (__predict_false(cnp->cn_nameiop == CREATE)) { + if (cnp->cn_nameiop == CREATE) { if (cnp->cn_flags & ISLASTCN) { vfs_smr_exit(); goto out_fallback; @@ -4589,7 +4592,10 @@ out: case CACHE_FPL_STATUS_HANDLED: MPASS(error != CACHE_FPL_FAILED); cache_fpl_smr_assert_not_entered(fpl); - if (__predict_false(error != 0)) { + /* + * A common error is ENOENT. + */ + if (error != 0) { ndp->ni_dvp = NULL; ndp->ni_vp = NULL; cache_fpl_cleanup_cnp(cnp);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202012132129.0BDLTdq0007912>