Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 May 2019 06:39:30 +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: r347503 - head/sys/kern
Message-ID:  <201905120639.x4C6dU31094625@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Sun May 12 06:39:30 2019
New Revision: 347503
URL: https://svnweb.freebsd.org/changeset/base/347503

Log:
  cache: push sdt probes in cache_zap_locked to code doing the work
  
  Avoids branching to check which probe to evaluate. Very same check was
  being done later to do the actual work.
  
  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:36:54 2019	(r347502)
+++ head/sys/kern/vfs_cache.c	Sun May 12 06:39:30 2019	(r347503)
@@ -851,19 +851,16 @@ cache_zap_locked(struct namecache *ncp, bool neg_locke
 
 	CTR2(KTR_VFS, "cache_zap(%p) vp %p", ncp,
 	    (ncp->nc_flag & NCF_NEGATIVE) ? NULL : ncp->nc_vp);
+	LIST_REMOVE(ncp, nc_hash);
 	if (!(ncp->nc_flag & NCF_NEGATIVE)) {
 		SDT_PROBE3(vfs, namecache, zap, done, ncp->nc_dvp,
 		    ncp->nc_name, ncp->nc_vp);
-	} else {
-		SDT_PROBE3(vfs, namecache, zap_negative, done, ncp->nc_dvp,
-		    ncp->nc_name, ncp->nc_neghits);
-	}
-	LIST_REMOVE(ncp, nc_hash);
-	if (!(ncp->nc_flag & NCF_NEGATIVE)) {
 		TAILQ_REMOVE(&ncp->nc_vp->v_cache_dst, ncp, nc_dst);
 		if (ncp == ncp->nc_vp->v_cache_dd)
 			ncp->nc_vp->v_cache_dd = NULL;
 	} else {
+		SDT_PROBE3(vfs, namecache, zap_negative, done, ncp->nc_dvp,
+		    ncp->nc_name, ncp->nc_neghits);
 		cache_negative_remove(ncp, neg_locked);
 	}
 	if (ncp->nc_flag & NCF_ISDOTDOT) {



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