Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Nov 2017 21:59: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: r325451 - head/sys/kern
Message-ID:  <201711052159.vA5Lxdr3094281@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Sun Nov  5 21:59:39 2017
New Revision: 325451
URL: https://svnweb.freebsd.org/changeset/base/325451

Log:
  namecache: skip locking in cache_lookup_nomakeentry if there is no entry

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c	Sun Nov  5 21:43:26 2017	(r325450)
+++ head/sys/kern/vfs_cache.c	Sun Nov  5 21:59:39 2017	(r325451)
@@ -1163,6 +1163,9 @@ retry_dotdot:
 	hash = cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp);
 	blp = HASH2BUCKETLOCK(hash);
 retry:
+	if (LIST_EMPTY(NCHHASH(hash)))
+		goto out_no_entry;
+
 	rw_rlock(blp);
 
 	LIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) {
@@ -1175,10 +1178,7 @@ retry:
 	/* We failed to find an entry */
 	if (ncp == NULL) {
 		rw_runlock(blp);
-		SDT_PROBE3(vfs, namecache, lookup, miss, dvp, cnp->cn_nameptr,
-		    NULL);
-		counter_u64_add(nummisszap, 1);
-		return (0);
+		goto out_no_entry;
 	}
 
 	counter_u64_add(numposzaps, 1);
@@ -1190,6 +1190,10 @@ retry:
 		goto retry;
 	}
 	cache_free(ncp);
+	return (0);
+out_no_entry:
+	SDT_PROBE3(vfs, namecache, lookup, miss, dvp, cnp->cn_nameptr, NULL);
+	counter_u64_add(nummisszap, 1);
 	return (0);
 }
 



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