| 1093 | } |
| 1094 | |
| 1095 | static void |
| 1096 | buf_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. |
no test coverage detected