svn commit: r366283 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Wed Sep 30 04:27:38 UTC 2020


Author: mjg
Date: Wed Sep 30 04:27:38 2020
New Revision: 366283
URL: https://svnweb.freebsd.org/changeset/base/366283

Log:
  cache: use cache_has_entries where appropriate instead of opencoding it

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c	Wed Sep 30 03:38:13 2020	(r366282)
+++ head/sys/kern/vfs_cache.c	Wed Sep 30 04:27:38 2020	(r366283)
@@ -2240,8 +2240,7 @@ cache_purge_vgone(struct vnode *vp)
 
 	VNPASS(VN_IS_DOOMED(vp), vp);
 	vlp = VP2VNODELOCK(vp);
-	if (!(LIST_EMPTY(&vp->v_cache_src) && TAILQ_EMPTY(&vp->v_cache_dst) &&
-	    vp->v_cache_dd == NULL)) {
+	if (cache_has_entries(vp)) {
 		mtx_lock(vlp);
 		cache_purge_impl(vp);
 		mtx_assert(vlp, MA_NOTOWNED);
@@ -2249,12 +2248,10 @@ cache_purge_vgone(struct vnode *vp)
 	}
 
 	/*
-	 * All the NULL pointer state we found above may be transient.
-	 * Serialize against a possible thread doing cache_purge.
+	 * Serialize against a potential thread doing cache_purge.
 	 */
 	mtx_wait_unlocked(vlp);
-	if (!(LIST_EMPTY(&vp->v_cache_src) && TAILQ_EMPTY(&vp->v_cache_dst) &&
-	    vp->v_cache_dd == NULL)) {
+	if (cache_has_entries(vp)) {
 		mtx_lock(vlp);
 		cache_purge_impl(vp);
 		mtx_assert(vlp, MA_NOTOWNED);


More information about the svn-src-head mailing list