* If tracking is enabled, return true if a reference does not exist that * matches the "holder" tag. If tracking is disabled, always return true * since the reference might not be held. */
| 303 | * since the reference might not be held. |
| 304 | */ |
| 305 | boolean_t |
| 306 | zfs_refcount_not_held(zfs_refcount_t *rc, const void *holder) |
| 307 | { |
| 308 | reference_t *ref; |
| 309 | |
| 310 | mutex_enter(&rc->rc_mtx); |
| 311 | |
| 312 | if (!rc->rc_tracked) { |
| 313 | mutex_exit(&rc->rc_mtx); |
| 314 | return (B_TRUE); |
| 315 | } |
| 316 | |
| 317 | for (ref = list_head(&rc->rc_list); ref; |
| 318 | ref = list_next(&rc->rc_list, ref)) { |
| 319 | if (ref->ref_holder == holder) { |
| 320 | mutex_exit(&rc->rc_mtx); |
| 321 | return (B_FALSE); |
| 322 | } |
| 323 | } |
| 324 | mutex_exit(&rc->rc_mtx); |
| 325 | return (B_TRUE); |
| 326 | } |
| 327 | #endif /* ZFS_DEBUG */ |
no test coverage detected