aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2020-08-26 12:53:16 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2020-08-26 12:53:16 +0000
commit075f58f2319688420d8c4a70e333dd5d8e3c6816 (patch)
treee04607bedb38c3465d300596270e5d1b417aae30
parent66fa11c898be3e66a5a9c2967358a2e26c6bbbe9 (diff)
downloadsrc-075f58f2319688420d8c4a70e333dd5d8e3c6816.tar.gz
src-075f58f2319688420d8c4a70e333dd5d8e3c6816.zip
cache: stop null checking in cache_free
Notes
Notes: svn path=/head/; revision=364815
-rw-r--r--sys/kern/vfs_cache.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 147e94e22212..5ac88c0b2774 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -388,8 +388,7 @@ cache_free(struct namecache *ncp)
{
struct namecache_ts *ncp_ts;
- if (ncp == NULL)
- return;
+ MPASS(ncp != NULL);
if ((ncp->nc_flag & NCF_DVDROP) != 0)
vdrop(ncp->nc_dvp);
if (__predict_false(ncp->nc_flag & NCF_TS)) {
@@ -980,7 +979,8 @@ cache_negative_zap_one(void)
}
mtx_unlock(blp);
mtx_unlock(dvlp);
- cache_free(ncp);
+ if (ncp != NULL)
+ cache_free(ncp);
}
/*
@@ -1962,7 +1962,8 @@ cache_enter_dotdot_prep(struct vnode *dvp, struct vnode *vp,
dvp->v_cache_dd = NULL;
vn_seqc_write_end(dvp);
cache_enter_unlock(&cel);
- cache_free(ncp);
+ if (ncp != NULL)
+ cache_free(ncp);
}
/*
@@ -2158,7 +2159,8 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp,
cache_enter_unlock(&cel);
if (numneg * ncnegfactor > lnumcache)
cache_negative_zap_one();
- cache_free(ndd);
+ if (ndd != NULL)
+ cache_free(ndd);
return;
out_unlock_free:
cache_enter_unlock(&cel);