FreeBSD/sys/kern/vfs_cache.c
/*
 * cache_zap():
 *
 *   Removes a namecache entry from cache, whether it contains an actual
 *   pointer to a vnode or if it is just a negative cache entry.
 */
Removes a namecache entry from cache, whether it contains an actual
pointer to a vnode or if it is just a negative cache entry.
Removes a namecache entry from cache whether it contains an actual pointer to a vnode or if it is just a negative cache entry .
static void
cache_zap(struct namecache *ncp)
{
	struct vnode *vp;
	rw_assert(&cache_lock, RA_WLOCKED);
	CTR2(KTR_VFS, "cache_zap(%p) vp %p", ncp, ncp->nc_vp);
	if (ncp->nc_vp != NULL) {
		SDT_PROBE3(vfs, namecache, zap, done, ncp->nc_dvp,
		    nc_get_name(ncp), ncp->nc_vp);
	} else {
		SDT_PROBE2(vfs, namecache, zap_negative, done, ncp->nc_dvp,
		    nc_get_name(ncp));
	}
	vp = NULL;
	LIST_REMOVE(ncp, nc_hash);
	if (ncp->nc_flag & NCF_ISDOTDOT) {
		if (ncp == ncp->nc_dvp->v_cache_dd)
			ncp->nc_dvp->v_cache_dd = NULL;
	} else {
		LIST_REMOVE(ncp, nc_src);
		if (LIST_EMPTY(&ncp->nc_dvp->v_cache_src)) {
			vp = ncp->nc_dvp;
			numcachehv--;
		}
	}
	if (ncp->nc_vp) {
		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 {
		TAILQ_REMOVE(&ncneg, ncp, nc_dst);
		numneg--;
	}
	numcache--;
	cache_free(ncp);
	if (vp != NULL)
		vdrop(vp);
}
static void cache_zap ( struct namecache * ncp ) { struct vnode * vp ; rw_assert ( & cache_lock , RA_WLOCKED ) ; CTR2 ( KTR_VFS , " " , ncp , ncp -> nc_vp ) ; if ( ncp -> nc_vp != NULL ) { SDT_PROBE3 ( vfs , namecache , zap , done , ncp -> nc_dvp , nc_get_name ( ncp ) , ncp -> nc_vp ) ; } else { SDT_PROBE2 ( vfs , namecache , zap_negative , done , ncp -> nc_dvp , nc_get_name ( ncp ) ) ; } vp = NULL ; LIST_REMOVE ( ncp , nc_hash ) ; if ( ncp -> nc_flag & NCF_ISDOTDOT ) { if ( ncp == ncp -> nc_dvp -> v_cache_dd ) ncp -> nc_dvp -> v_cache_dd = NULL ; } else { LIST_REMOVE ( ncp , nc_src ) ; if ( LIST_EMPTY ( & ncp -> nc_dvp -> v_cache_src ) ) { vp = ncp -> nc_dvp ; numcachehv -- ; } } if ( ncp -> nc_vp ) { 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 { TAILQ_REMOVE ( & ncneg , ncp , nc_dst ) ; numneg -- ; } numcache -- ; cache_free ( ncp ) ; if ( vp != NULL ) vdrop ( vp ) ; }
cache_zap():
   Removes a namecache entry from cache, whether it contains an actual
   pointer to a vnode or if it is just a negative cache entry.
cache_zap () : Removes a namecache entry from cache whether it contains an actual pointer to a vnode or if it is just a negative cache entry .