Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Dec 2020 02:03:18 GMT
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: ff97bc034fcd - main - cache: simplify lockless dot lookups
Message-ID:  <202012280203.0BS23I5T005369@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=ff97bc034fcdf16207ed75e43622e9f0d91fa553

commit ff97bc034fcdf16207ed75e43622e9f0d91fa553
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2020-12-28 00:12:28 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2020-12-28 01:53:27 +0000

    cache: simplify lockless dot lookups
---
 sys/kern/vfs_cache.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 75c362534c91..22dfe01ac624 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -4317,19 +4317,18 @@ cache_fplookup_noentry(struct cache_fpl *fpl)
 static int __noinline
 cache_fplookup_dot(struct cache_fpl *fpl)
 {
-	struct vnode *dvp;
-
-	dvp = fpl->dvp;
 
-	fpl->tvp = dvp;
-	fpl->tvp_seqc = vn_seqc_read_any(dvp);
-	if (seqc_in_modify(fpl->tvp_seqc)) {
-		return (cache_fpl_aborted(fpl));
-	}
+	MPASS(!seqc_in_modify(fpl->dvp_seqc));
+	/*
+	 * Just re-assign the value. seqc will be checked later for the first
+	 * non-dot path component in line and/or before deciding to return the
+	 * vnode.
+	 */
+	fpl->tvp = fpl->dvp;
+	fpl->tvp_seqc = fpl->dvp_seqc;
 
 	counter_u64_add(dothits, 1);
-	SDT_PROBE3(vfs, namecache, lookup, hit, dvp, ".", dvp);
-
+	SDT_PROBE3(vfs, namecache, lookup, hit, fpl->dvp, ".", fpl->dvp);
 	return (0);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202012280203.0BS23I5T005369>