| 557 | } |
| 558 | |
| 559 | static void |
| 560 | dnode_sync_free(dnode_t *dn, dmu_tx_t *tx) |
| 561 | { |
| 562 | int txgoff = tx->tx_txg & TXG_MASK; |
| 563 | |
| 564 | ASSERT(dmu_tx_is_syncing(tx)); |
| 565 | |
| 566 | /* |
| 567 | * Our contents should have been freed in dnode_sync() by the |
| 568 | * free range record inserted by the caller of dnode_free(). |
| 569 | */ |
| 570 | ASSERT0(DN_USED_BYTES(dn->dn_phys)); |
| 571 | ASSERT(BP_IS_HOLE(dn->dn_phys->dn_blkptr)); |
| 572 | |
| 573 | dnode_undirty_dbufs(&dn->dn_dirty_records[txgoff]); |
| 574 | dnode_evict_dbufs(dn); |
| 575 | |
| 576 | /* |
| 577 | * XXX - It would be nice to assert this, but we may still |
| 578 | * have residual holds from async evictions from the arc... |
| 579 | * |
| 580 | * zfs_obj_to_path() also depends on this being |
| 581 | * commented out. |
| 582 | * |
| 583 | * ASSERT3U(zfs_refcount_count(&dn->dn_holds), ==, 1); |
| 584 | */ |
| 585 | |
| 586 | /* Undirty next bits */ |
| 587 | dn->dn_next_nlevels[txgoff] = 0; |
| 588 | dn->dn_next_indblkshift[txgoff] = 0; |
| 589 | dn->dn_next_blksz[txgoff] = 0; |
| 590 | dn->dn_next_maxblkid[txgoff] = 0; |
| 591 | |
| 592 | /* ASSERT(blkptrs are zero); */ |
| 593 | ASSERT(dn->dn_phys->dn_type != DMU_OT_NONE); |
| 594 | ASSERT(dn->dn_type != DMU_OT_NONE); |
| 595 | |
| 596 | ASSERT(dn->dn_free_txg > 0); |
| 597 | if (dn->dn_allocated_txg != dn->dn_free_txg) |
| 598 | dmu_buf_will_dirty(&dn->dn_dbuf->db, tx); |
| 599 | bzero(dn->dn_phys, sizeof (dnode_phys_t) * dn->dn_num_slots); |
| 600 | dnode_free_interior_slots(dn); |
| 601 | |
| 602 | mutex_enter(&dn->dn_mtx); |
| 603 | dn->dn_type = DMU_OT_NONE; |
| 604 | dn->dn_maxblkid = 0; |
| 605 | dn->dn_allocated_txg = 0; |
| 606 | dn->dn_free_txg = 0; |
| 607 | dn->dn_have_spill = B_FALSE; |
| 608 | dn->dn_num_slots = 1; |
| 609 | mutex_exit(&dn->dn_mtx); |
| 610 | |
| 611 | ASSERT(dn->dn_object != DMU_META_DNODE_OBJECT); |
| 612 | |
| 613 | dnode_rele(dn, (void *)(uintptr_t)tx->tx_txg); |
| 614 | /* |
| 615 | * Now that we've released our hold, the dnode may |
| 616 | * be evicted, so we mustn't access it. |
no test coverage detected