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

Function buf_hash_remove

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

Source from the content-addressed store, hash-verified

1093}
1094
1095static void
1096buf_hash_remove(arc_buf_hdr_t *hdr)
1097{
1098 arc_buf_hdr_t *fhdr, **hdrp;
1099 uint64_t idx = BUF_HASH_INDEX(hdr->b_spa, &hdr->b_dva, hdr->b_birth);
1100
1101 ASSERT(MUTEX_HELD(BUF_HASH_LOCK(idx)));
1102 ASSERT(HDR_IN_HASH_TABLE(hdr));
1103
1104 hdrp = &buf_hash_table.ht_table[idx];
1105 while ((fhdr = *hdrp) != hdr) {
1106 ASSERT3P(fhdr, !=, NULL);
1107 hdrp = &fhdr->b_hash_next;
1108 }
1109 *hdrp = hdr->b_hash_next;
1110 hdr->b_hash_next = NULL;
1111 arc_hdr_clear_flags(hdr, ARC_FLAG_IN_HASH_TABLE);
1112
1113 /* collect some hash table performance data */
1114 ARCSTAT_BUMPDOWN(arcstat_hash_elements);
1115
1116 if (buf_hash_table.ht_table[idx] &&
1117 buf_hash_table.ht_table[idx]->b_hash_next == NULL)
1118 ARCSTAT_BUMPDOWN(arcstat_hash_chains);
1119}
1120
1121/*
1122 * Global data structures and functions for the buf kmem cache.

Callers 3

arc_change_stateFunction · 0.85
arc_hdr_reallocFunction · 0.85
arc_read_doneFunction · 0.85

Calls 1

arc_hdr_clear_flagsFunction · 0.85

Tested by

no test coverage detected