* Increment the amount of evictable space in the arc_state_t's refcount. * We account for the space used by the hdr and the arc buf individually * so that we can add and remove them from the refcount individually. */
| 2227 | * so that we can add and remove them from the refcount individually. |
| 2228 | */ |
| 2229 | static void |
| 2230 | arc_evictable_space_increment(arc_buf_hdr_t *hdr, arc_state_t *state) |
| 2231 | { |
| 2232 | arc_buf_contents_t type = arc_buf_type(hdr); |
| 2233 | |
| 2234 | ASSERT(HDR_HAS_L1HDR(hdr)); |
| 2235 | |
| 2236 | if (GHOST_STATE(state)) { |
| 2237 | ASSERT0(hdr->b_l1hdr.b_bufcnt); |
| 2238 | ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); |
| 2239 | ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL); |
| 2240 | ASSERT(!HDR_HAS_RABD(hdr)); |
| 2241 | (void) zfs_refcount_add_many(&state->arcs_esize[type], |
| 2242 | HDR_GET_LSIZE(hdr), hdr); |
| 2243 | return; |
| 2244 | } |
| 2245 | |
| 2246 | ASSERT(!GHOST_STATE(state)); |
| 2247 | if (hdr->b_l1hdr.b_pabd != NULL) { |
| 2248 | (void) zfs_refcount_add_many(&state->arcs_esize[type], |
| 2249 | arc_hdr_size(hdr), hdr); |
| 2250 | } |
| 2251 | if (HDR_HAS_RABD(hdr)) { |
| 2252 | (void) zfs_refcount_add_many(&state->arcs_esize[type], |
| 2253 | HDR_GET_PSIZE(hdr), hdr); |
| 2254 | } |
| 2255 | |
| 2256 | for (arc_buf_t *buf = hdr->b_l1hdr.b_buf; buf != NULL; |
| 2257 | buf = buf->b_next) { |
| 2258 | if (arc_buf_is_shared(buf)) |
| 2259 | continue; |
| 2260 | (void) zfs_refcount_add_many(&state->arcs_esize[type], |
| 2261 | arc_buf_size(buf), buf); |
| 2262 | } |
| 2263 | } |
| 2264 | |
| 2265 | /* |
| 2266 | * Decrement the amount of evictable space in the arc_state_t's refcount. |
no test coverage detected