svn commit: r364418 - head/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Thu Aug 20 10:05:19 UTC 2020
Author: mjg
Date: Thu Aug 20 10:05:19 2020
New Revision: 364418
URL: https://svnweb.freebsd.org/changeset/base/364418
Log:
cache: reimplement cache_lookup_nomakeentry as cache_remove_cnp
This in particular removes unused arguments.
Modified:
head/sys/kern/vfs_cache.c
Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c Thu Aug 20 05:18:08 2020 (r364417)
+++ head/sys/kern/vfs_cache.c Thu Aug 20 10:05:19 2020 (r364418)
@@ -97,6 +97,10 @@ SDT_PROBE_DEFINE2(vfs, namecache, lookup, hit__negativ
"struct vnode *", "char *");
SDT_PROBE_DEFINE2(vfs, namecache, lookup, miss, "struct vnode *",
"char *");
+SDT_PROBE_DEFINE2(vfs, namecache, removecnp, hit, "struct vnode *",
+ "struct componentname *");
+SDT_PROBE_DEFINE2(vfs, namecache, removecnp, miss, "struct vnode *",
+ "struct componentname *");
SDT_PROBE_DEFINE1(vfs, namecache, purge, done, "struct vnode *");
SDT_PROBE_DEFINE1(vfs, namecache, purge_negative, done, "struct vnode *");
SDT_PROBE_DEFINE1(vfs, namecache, purgevfs, done, "struct mount *");
@@ -1306,8 +1310,7 @@ cache_lookup_dot(struct vnode *dvp, struct vnode **vpp
}
static __noinline int
-cache_lookup_nomakeentry(struct vnode *dvp, struct vnode **vpp,
- struct componentname *cnp, struct timespec *tsp, int *ticksp)
+cache_remove_cnp(struct vnode *dvp, struct componentname *cnp)
{
struct namecache *ncp;
struct rwlock *blp;
@@ -1317,18 +1320,16 @@ cache_lookup_nomakeentry(struct vnode *dvp, struct vno
if (cnp->cn_namelen == 2 &&
cnp->cn_nameptr[0] == '.' && cnp->cn_nameptr[1] == '.') {
- counter_u64_add(dotdothits, 1);
dvlp = VP2VNODELOCK(dvp);
dvlp2 = NULL;
mtx_lock(dvlp);
retry_dotdot:
ncp = dvp->v_cache_dd;
if (ncp == NULL) {
- SDT_PROBE3(vfs, namecache, lookup, miss, dvp,
- "..", NULL);
mtx_unlock(dvlp);
if (dvlp2 != NULL)
mtx_unlock(dvlp2);
+ SDT_PROBE2(vfs, namecache, removecnp, miss, dvp, cnp);
return (0);
}
if ((ncp->nc_flag & NCF_ISDOTDOT) != 0) {
@@ -1350,7 +1351,8 @@ retry_dotdot:
if (dvlp2 != NULL)
mtx_unlock(dvlp2);
}
- return (0);
+ SDT_PROBE2(vfs, namecache, removecnp, hit, dvp, cnp);
+ return (1);
}
hash = cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp);
@@ -1381,9 +1383,10 @@ retry:
}
counter_u64_add(numposzaps, 1);
cache_free(ncp);
- return (0);
+ SDT_PROBE2(vfs, namecache, removecnp, hit, dvp, cnp);
+ return (1);
out_no_entry:
- SDT_PROBE3(vfs, namecache, lookup, miss, dvp, cnp->cn_nameptr, NULL);
+ SDT_PROBE2(vfs, namecache, removecnp, miss, dvp, cnp);
counter_u64_add(nummisszap, 1);
return (0);
}
@@ -1448,8 +1451,10 @@ cache_lookup(struct vnode *dvp, struct vnode **vpp, st
if (__predict_false(cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.'))
return (cache_lookup_dot(dvp, vpp, cnp, tsp, ticksp));
- if ((cnp->cn_flags & MAKEENTRY) == 0)
- return (cache_lookup_nomakeentry(dvp, vpp, cnp, tsp, ticksp));
+ if ((cnp->cn_flags & MAKEENTRY) == 0) {
+ cache_remove_cnp(dvp, cnp);
+ return (0);
+ }
try_smr = true;
if (cnp->cn_nameiop == CREATE)
More information about the svn-src-all
mailing list