* Can only add a reference if there is already at least one * reference on the dnode. Returns FALSE if unable to add a * new reference. */
| 1583 | * new reference. |
| 1584 | */ |
| 1585 | boolean_t |
| 1586 | dnode_add_ref(dnode_t *dn, void *tag) |
| 1587 | { |
| 1588 | mutex_enter(&dn->dn_mtx); |
| 1589 | if (zfs_refcount_is_zero(&dn->dn_holds)) { |
| 1590 | mutex_exit(&dn->dn_mtx); |
| 1591 | return (FALSE); |
| 1592 | } |
| 1593 | VERIFY(1 < zfs_refcount_add(&dn->dn_holds, tag)); |
| 1594 | mutex_exit(&dn->dn_mtx); |
| 1595 | return (TRUE); |
| 1596 | } |
| 1597 | |
| 1598 | void |
| 1599 | dnode_rele(dnode_t *dn, void *tag) |
no test coverage detected