From owner-dev-commits-src-main@freebsd.org Thu Jan 7 23:30:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9057B4E0045; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DBjC225zKz4YVg; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3535819894; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NUMRY075859; Thu, 7 Jan 2021 23:30:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NUMZE075858; Thu, 7 Jan 2021 23:30:22 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:30:22 GMT Message-Id: <202101072330.107NUMZE075858@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: fee405e057a2 - main - cache: stop checkpointing cn_flags MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fee405e057a2d333e64916e8273923444ef3de60 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:30:22 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=fee405e057a2d333e64916e8273923444ef3de60 commit fee405e057a2d333e64916e8273923444ef3de60 Author: Mateusz Guzik AuthorDate: 2021-01-07 05:35:56 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-07 23:29:52 +0000 cache: stop checkpointing cn_flags They are only modified, if ever, for the last component. --- sys/kern/vfs_cache.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 7d774466be53..811aeb91d9c9 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3614,12 +3614,15 @@ SYSCTL_PROC(_vfs, OID_AUTO, cache_fast_lookup, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MP * Components of nameidata (or objects it can point to) which may * need restoring in case fast path lookup fails. */ +struct nameidata_outer { + int cn_flags; +}; + struct nameidata_saved { #ifdef INVARIANTS char *cn_nameptr; size_t ni_pathlen; #endif - int cn_flags; }; #ifdef INVARIANTS @@ -3638,7 +3641,7 @@ struct cache_fpl { seqc_t dvp_seqc; seqc_t tvp_seqc; struct nameidata_saved snd; - struct nameidata_saved snd_orig; + struct nameidata_outer snd_outer; int line; enum cache_fpl_status status:8; bool in_smr; @@ -3692,31 +3695,37 @@ cache_fpl_handle_root(struct cache_fpl *fpl) } static void -cache_fpl_checkpoint(struct cache_fpl *fpl, struct nameidata_saved *snd) +cache_fpl_checkpoint_outer(struct cache_fpl *fpl) +{ + + fpl->snd_outer.cn_flags = fpl->ndp->ni_cnd.cn_flags; +} + +static void +cache_fpl_checkpoint(struct cache_fpl *fpl) { - snd->cn_flags = fpl->ndp->ni_cnd.cn_flags; #ifdef INVARIANTS - snd->cn_nameptr = fpl->ndp->ni_cnd.cn_nameptr; - snd->ni_pathlen = fpl->debug.ni_pathlen; + fpl->snd.cn_nameptr = fpl->ndp->ni_cnd.cn_nameptr; + fpl->snd.ni_pathlen = fpl->debug.ni_pathlen; #endif } static void -cache_fpl_restore_partial(struct cache_fpl *fpl, struct nameidata_saved *snd) +cache_fpl_restore_partial(struct cache_fpl *fpl) { - fpl->ndp->ni_cnd.cn_flags = snd->cn_flags; + fpl->ndp->ni_cnd.cn_flags = fpl->snd_outer.cn_flags; #ifdef INVARIANTS - fpl->debug.ni_pathlen = snd->ni_pathlen; + fpl->debug.ni_pathlen = fpl->snd.ni_pathlen; #endif } static void -cache_fpl_restore_abort(struct cache_fpl *fpl, struct nameidata_saved *snd) +cache_fpl_restore_abort(struct cache_fpl *fpl) { - cache_fpl_restore_partial(fpl, snd); + cache_fpl_restore_partial(fpl); /* * It is 0 on entry by API contract. */ @@ -3805,7 +3814,7 @@ cache_fpl_aborted_impl(struct cache_fpl *fpl, int line) fpl->line = line; if (fpl->in_smr) cache_fpl_smr_exit(fpl); - cache_fpl_restore_abort(fpl, &fpl->snd_orig); + cache_fpl_restore_abort(fpl); return (CACHE_FPL_FAILED); } @@ -4017,7 +4026,7 @@ cache_fplookup_partial_setup(struct cache_fpl *fpl) return (cache_fpl_aborted(fpl)); } - cache_fpl_restore_partial(fpl, &fpl->snd); + cache_fpl_restore_partial(fpl); #ifdef INVARIANTS if (cnp->cn_nameptr != fpl->snd.cn_nameptr) { panic("%s: cn_nameptr mismatch (%p != %p) full [%s]\n", __func__, @@ -5219,7 +5228,7 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) ndp = fpl->ndp; cnp = fpl->cnp; - cache_fpl_checkpoint(fpl, &fpl->snd); + cache_fpl_checkpoint(fpl); /* * The vnode at hand is almost always stable, skip checking for it. @@ -5276,7 +5285,7 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) fpl->dvp_seqc = fpl->tvp_seqc; cache_fplookup_parse_advance(fpl); - cache_fpl_checkpoint(fpl, &fpl->snd); + cache_fpl_checkpoint(fpl); } return (error); @@ -5388,7 +5397,7 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, return (EOPNOTSUPP); } - cache_fpl_checkpoint(&fpl, &fpl.snd_orig); + cache_fpl_checkpoint_outer(&fpl); cache_fpl_smr_enter_initial(&fpl); #ifdef INVARIANTS