cache: add cache_assert_no_entries

This commit is contained in:
Mateusz Guzik 2022-10-24 15:34:57 +00:00
parent 9cf5db6369
commit d653aaec7a
2 changed files with 15 additions and 0 deletions

View file

@ -2998,6 +2998,15 @@ cache_validate(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
}
mtx_unlock(blp);
}
void
cache_assert_no_entries(struct vnode *vp)
{
VNPASS(TAILQ_EMPTY(&vp->v_cache_dst), vp);
VNPASS(LIST_EMPTY(&vp->v_cache_src), vp);
VNPASS(vp->v_cache_dd == NULL, vp);
}
#endif
/*

View file

@ -676,11 +676,17 @@ void cache_vop_rmdir(struct vnode *dvp, struct vnode *vp);
#ifdef INVARIANTS
void cache_validate(struct vnode *dvp, struct vnode *vp,
struct componentname *cnp);
void cache_assert_no_entries(struct vnode *vp);
#else
static inline void
cache_validate(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
{
}
static inline void
cache_assert_no_entries(struct vnode *vp)
{
}
#endif
void cache_fast_lookup_enabled_recalc(void);
int change_dir(struct vnode *vp, struct thread *td);