MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cache_vop_rename

Function cache_vop_rename

freebsd/kern/vfs_cache.c:2740–2774  ·  view source on GitHub ↗

* Entry points for modifying VOP operations. */

Source from the content-addressed store, hash-verified

2738 * Entry points for modifying VOP operations.
2739 */
2740void
2741cache_vop_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp,
2742 struct vnode *tvp, struct componentname *fcnp, struct componentname *tcnp)
2743{
2744
2745 ASSERT_VOP_IN_SEQC(fdvp);
2746 ASSERT_VOP_IN_SEQC(fvp);
2747 ASSERT_VOP_IN_SEQC(tdvp);
2748 if (tvp != NULL)
2749 ASSERT_VOP_IN_SEQC(tvp);
2750
2751 cache_purge(fvp);
2752 if (tvp != NULL) {
2753 cache_purge(tvp);
2754 KASSERT(!cache_remove_cnp(tdvp, tcnp),
2755 ("%s: lingering negative entry", __func__));
2756 } else {
2757 cache_remove_cnp(tdvp, tcnp);
2758 }
2759
2760 /*
2761 * TODO
2762 *
2763 * Historically renaming was always purging all revelang entries,
2764 * but that's quite wasteful. In particular turns out that in many cases
2765 * the target file is immediately accessed after rename, inducing a cache
2766 * miss.
2767 *
2768 * Recode this to reduce relocking and reuse the existing entry (if any)
2769 * instead of just removing it above and allocating a new one here.
2770 */
2771 if (cache_rename_add) {
2772 cache_enter(tdvp, fvp, tcnp);
2773 }
2774}
2775
2776void
2777cache_vop_rmdir(struct vnode *dvp, struct vnode *vp)

Callers

nothing calls this directly

Calls 2

cache_purgeFunction · 0.85
cache_remove_cnpFunction · 0.85

Tested by

no test coverage detected