* Free the arc data buffer. */
| 5387 | * Free the arc data buffer. |
| 5388 | */ |
| 5389 | static void |
| 5390 | arc_free_data_impl(arc_buf_hdr_t *hdr, uint64_t size, void *tag) |
| 5391 | { |
| 5392 | arc_state_t *state = hdr->b_l1hdr.b_state; |
| 5393 | arc_buf_contents_t type = arc_buf_type(hdr); |
| 5394 | |
| 5395 | /* protected by hash lock, if in the hash table */ |
| 5396 | if (multilist_link_active(&hdr->b_l1hdr.b_arc_node)) { |
| 5397 | ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); |
| 5398 | ASSERT(state != arc_anon && state != arc_l2c_only); |
| 5399 | |
| 5400 | (void) zfs_refcount_remove_many(&state->arcs_esize[type], |
| 5401 | size, tag); |
| 5402 | } |
| 5403 | (void) zfs_refcount_remove_many(&state->arcs_size, size, tag); |
| 5404 | |
| 5405 | VERIFY3U(hdr->b_type, ==, type); |
| 5406 | if (type == ARC_BUFC_METADATA) { |
| 5407 | arc_space_return(size, ARC_SPACE_META); |
| 5408 | } else { |
| 5409 | ASSERT(type == ARC_BUFC_DATA); |
| 5410 | arc_space_return(size, ARC_SPACE_DATA); |
| 5411 | } |
| 5412 | } |
| 5413 | |
| 5414 | /* |
| 5415 | * This routine is called whenever a buffer is accessed. |
no test coverage detected