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

Function remove_reference

freebsd/contrib/openzfs/module/zfs/arc.c:2348–2369  ·  view source on GitHub ↗

* Remove a reference from this hdr. When the reference transitions from * 1 to 0 and we're not anonymous, then we add this hdr to the arc_state_t's * list making it eligible for eviction. */

Source from the content-addressed store, hash-verified

2346 * list making it eligible for eviction.
2347 */
2348static int
2349remove_reference(arc_buf_hdr_t *hdr, kmutex_t *hash_lock, void *tag)
2350{
2351 int cnt;
2352 arc_state_t *state = hdr->b_l1hdr.b_state;
2353
2354 ASSERT(HDR_HAS_L1HDR(hdr));
2355 ASSERT(state == arc_anon || MUTEX_HELD(hash_lock));
2356 ASSERT(!GHOST_STATE(state));
2357
2358 /*
2359 * arc_l2c_only counts as a ghost state so we don't need to explicitly
2360 * check to prevent usage of the arc_l2c_only list.
2361 */
2362 if (((cnt = zfs_refcount_remove(&hdr->b_l1hdr.b_refcnt, tag)) == 0) &&
2363 (state != arc_anon)) {
2364 multilist_insert(state->arcs_list[arc_buf_type(hdr)], hdr);
2365 ASSERT3U(hdr->b_l1hdr.b_bufcnt, >, 0);
2366 arc_evictable_space_increment(hdr, state);
2367 }
2368 return (cnt);
2369}
2370
2371/*
2372 * Returns detailed information about a specific arc buffer. When the

Callers 3

arc_buf_destroyFunction · 0.85
arc_readFunction · 0.85
arc_releaseFunction · 0.85

Calls 4

zfs_refcount_removeFunction · 0.85
multilist_insertFunction · 0.85
arc_buf_typeFunction · 0.85

Tested by

no test coverage detected