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

Function cache_lock_vnodes_cel_3

freebsd/kern/vfs_cache.c:2086–2122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2084}
2085
2086static bool
2087cache_lock_vnodes_cel_3(struct celockstate *cel, struct vnode *vp)
2088{
2089 struct mtx *vlp;
2090 bool ret;
2091
2092 cache_assert_vlp_locked(cel->vlp[0]);
2093 cache_assert_vlp_locked(cel->vlp[1]);
2094 MPASS(cel->vlp[2] == NULL);
2095
2096 MPASS(vp != NULL);
2097 vlp = VP2VNODELOCK(vp);
2098
2099 ret = true;
2100 if (vlp >= cel->vlp[1]) {
2101 mtx_lock(vlp);
2102 } else {
2103 if (mtx_trylock(vlp))
2104 goto out;
2105 cache_lock_vnodes_cel_3_failures++;
2106 cache_unlock_vnodes_cel(cel);
2107 if (vlp < cel->vlp[0]) {
2108 mtx_lock(vlp);
2109 mtx_lock(cel->vlp[0]);
2110 mtx_lock(cel->vlp[1]);
2111 } else {
2112 if (cel->vlp[0] != NULL)
2113 mtx_lock(cel->vlp[0]);
2114 mtx_lock(vlp);
2115 mtx_lock(cel->vlp[1]);
2116 }
2117 ret = false;
2118 }
2119out:
2120 cel->vlp[2] = vlp;
2121 return (ret);
2122}
2123
2124static void
2125cache_lock_buckets_cel(struct celockstate *cel, struct mtx *blp1,

Callers 2

cache_enter_lockFunction · 0.85
cache_enter_lock_ddFunction · 0.85

Calls 4

cache_assert_vlp_lockedFunction · 0.85
VP2VNODELOCKFunction · 0.85
cache_unlock_vnodes_celFunction · 0.85
mtx_lockFunction · 0.70

Tested by

no test coverage detected