Lines Matching +full:os +full:- +full:initiated

1 // SPDX-License-Identifier: CDDL-1.0
10 * or https://opensource.org/licenses/CDDL-1.0.
46 int txgoff = tx->tx_txg & TXG_MASK; in dnode_increase_indirection()
47 int nblkptr = dn->dn_phys->dn_nblkptr; in dnode_increase_indirection()
48 int old_toplvl = dn->dn_phys->dn_nlevels - 1; in dnode_increase_indirection()
49 int new_level = dn->dn_next_nlevels[txgoff]; in dnode_increase_indirection()
52 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_increase_indirection()
55 ASSERT(dn->dn_phys->dn_type != DMU_OT_NONE); in dnode_increase_indirection()
56 ASSERT(new_level > 1 && dn->dn_phys->dn_nlevels > 0); in dnode_increase_indirection()
58 db = dbuf_hold_level(dn, dn->dn_phys->dn_nlevels, 0, FTAG); in dnode_increase_indirection()
61 dn->dn_phys->dn_nlevels = new_level; in dnode_increase_indirection()
62 dprintf("os=%p obj=%llu, increase to %d\n", dn->dn_objset, in dnode_increase_indirection()
63 (u_longlong_t)dn->dn_object, dn->dn_phys->dn_nlevels); in dnode_increase_indirection()
74 children[i] = dbuf_find(dn->dn_objset, dn->dn_object, in dnode_increase_indirection()
80 if (dn->dn_dbuf != NULL) in dnode_increase_indirection()
81 rw_enter(&dn->dn_dbuf->db_rwlock, RW_WRITER); in dnode_increase_indirection()
82 rw_enter(&db->db_rwlock, RW_WRITER); in dnode_increase_indirection()
83 ASSERT(db->db.db_data); in dnode_increase_indirection()
84 ASSERT(arc_released(db->db_buf)); in dnode_increase_indirection()
85 ASSERT3U(sizeof (blkptr_t) * nblkptr, <=, db->db.db_size); in dnode_increase_indirection()
86 memcpy(db->db.db_data, dn->dn_phys->dn_blkptr, in dnode_increase_indirection()
88 arc_buf_freeze(db->db_buf); in dnode_increase_indirection()
101 if (child->db_parent && child->db_parent != dn->dn_dbuf) { in dnode_increase_indirection()
102 ASSERT(child->db_parent->db_level == db->db_level); in dnode_increase_indirection()
103 ASSERT(child->db_blkptr != in dnode_increase_indirection()
104 &dn->dn_phys->dn_blkptr[child->db_blkid]); in dnode_increase_indirection()
105 mutex_exit(&child->db_mtx); in dnode_increase_indirection()
108 ASSERT(child->db_parent == NULL || in dnode_increase_indirection()
109 child->db_parent == dn->dn_dbuf); in dnode_increase_indirection()
111 child->db_parent = db; in dnode_increase_indirection()
113 if (db->db.db_data) in dnode_increase_indirection()
114 child->db_blkptr = (blkptr_t *)db->db.db_data + i; in dnode_increase_indirection()
116 child->db_blkptr = NULL; in dnode_increase_indirection()
117 dprintf_dbuf_bp(child, child->db_blkptr, in dnode_increase_indirection()
120 mutex_exit(&child->db_mtx); in dnode_increase_indirection()
123 memset(dn->dn_phys->dn_blkptr, 0, sizeof (blkptr_t) * nblkptr); in dnode_increase_indirection()
125 rw_exit(&db->db_rwlock); in dnode_increase_indirection()
126 if (dn->dn_dbuf != NULL) in dnode_increase_indirection()
127 rw_exit(&dn->dn_dbuf->db_rwlock); in dnode_increase_indirection()
131 rw_exit(&dn->dn_struct_rwlock); in dnode_increase_indirection()
137 dsl_dataset_t *ds = dn->dn_objset->os_dsl_dataset; in free_blocks()
140 dprintf("ds=%p obj=%llx num=%d\n", ds, (u_longlong_t)dn->dn_object, in free_blocks()
148 ASSERT3U(bytesfreed, <=, DN_USED_BYTES(dn->dn_phys)); in free_blocks()
164 if (spa_feature_is_active(dn->dn_objset->os_spa, in free_blocks()
172 dnode_diduse_space(dn, -bytesfreed); in free_blocks()
182 uint64_t txg = tx->tx_txg; in free_verify()
187 epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT; in free_verify()
188 off = start - (db->db_blkid << epbs); in free_verify()
189 num = end - start + 1; in free_verify()
191 ASSERT3U(dn->dn_phys->dn_indblkshift, >=, SPA_BLKPTRSHIFT); in free_verify()
193 ASSERT3U(start, >=, (db->db_blkid << epbs)); in free_verify()
194 ASSERT3U(db->db_level, >, 0); in free_verify()
195 ASSERT3U(db->db.db_size, ==, 1 << dn->dn_phys->dn_indblkshift); in free_verify()
196 ASSERT3U(off+num, <=, db->db.db_size >> SPA_BLKPTRSHIFT); in free_verify()
197 ASSERT(db->db_blkptr != NULL); in free_verify()
204 ASSERT(db->db_level == 1); in free_verify()
206 rw_enter(&dn->dn_struct_rwlock, RW_READER); in free_verify()
207 err = dbuf_hold_impl(dn, db->db_level - 1, in free_verify()
208 (db->db_blkid << epbs) + i, TRUE, FALSE, FTAG, &child); in free_verify()
209 rw_exit(&dn->dn_struct_rwlock); in free_verify()
213 ASSERT(child->db_level == 0); in free_verify()
218 buf = dr->dt.dl.dr_data->b_data; in free_verify()
219 for (j = 0; j < child->db.db_size >> 3; j++) { in free_verify()
235 mutex_enter(&child->db_mtx); in free_verify()
236 buf = child->db.db_data; in free_verify()
237 if (buf != NULL && child->db_state != DB_FILL && in free_verify()
238 list_is_empty(&child->db_dirty_records)) { in free_verify()
239 for (j = 0; j < child->db.db_size >> 3; j++) { in free_verify()
250 mutex_exit(&child->db_mtx); in free_verify()
285 * 1 - if level > 1 and there are no children with level <= 1 in free_children()
286 * 2 - if this block was evicted since we read it from in free_children()
289 if (db->db_state != DB_CACHED) in free_children()
296 * be written (otherwise, we would have incorrect on-disk state in free_children()
302 * dirty, but the open-context code happens to dirty. E.g. if the in free_children()
309 VERIFY(BP_GET_FILL(db->db_blkptr) == 0 || db->db_dirtycnt > 0); in free_children()
313 bp = db->db.db_data; in free_children()
317 epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT; in free_children()
319 shift = (db->db_level - 1) * epbs; in free_children()
320 dbstart = db->db_blkid << epbs; in free_children()
323 bp += start - dbstart; in free_children()
327 dbend = ((db->db_blkid + 1) << epbs) - 1; in free_children()
328 end = (blkid + nblks - 1) >> shift; in free_children()
334 if (db->db_level == 1) { in free_children()
336 rw_enter(&db->db_rwlock, RW_WRITER); in free_children()
337 free_blocks(dn, bp, end - start + 1, tx); in free_children()
338 rw_exit(&db->db_rwlock); in free_children()
343 rw_enter(&dn->dn_struct_rwlock, RW_READER); in free_children()
344 VERIFY0(dbuf_hold_impl(dn, db->db_level - 1, in free_children()
346 rw_exit(&dn->dn_struct_rwlock); in free_children()
347 ASSERT3P(bp, ==, subdb->db_blkptr); in free_children()
355 rw_enter(&db->db_rwlock, RW_WRITER); in free_children()
356 for (i = 0, bp = db->db.db_data; i < 1 << epbs; i++, bp++) in free_children()
358 memset(db->db.db_data, 0, db->db.db_size); in free_children()
359 free_blocks(dn, db->db_blkptr, 1, tx); in free_children()
360 rw_exit(&db->db_rwlock); in free_children()
364 arc_buf_freeze(db->db_buf); in free_children()
375 blkptr_t *bp = dn->dn_phys->dn_blkptr; in dnode_sync_free_range_impl()
376 int dnlevel = dn->dn_phys->dn_nlevels; in dnode_sync_free_range_impl()
379 if (blkid > dn->dn_phys->dn_maxblkid) in dnode_sync_free_range_impl()
382 ASSERT(dn->dn_phys->dn_maxblkid < UINT64_MAX); in dnode_sync_free_range_impl()
383 if (blkid + nblks > dn->dn_phys->dn_maxblkid) { in dnode_sync_free_range_impl()
384 nblks = dn->dn_phys->dn_maxblkid - blkid + 1; in dnode_sync_free_range_impl()
390 if (blkid >= dn->dn_phys->dn_nblkptr) { in dnode_sync_free_range_impl()
394 ASSERT3U(blkid + nblks, <=, dn->dn_phys->dn_nblkptr); in dnode_sync_free_range_impl()
397 int shift = (dnlevel - 1) * in dnode_sync_free_range_impl()
398 (dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT); in dnode_sync_free_range_impl()
400 int end = (blkid + nblks - 1) >> shift; in dnode_sync_free_range_impl()
403 ASSERT(start < dn->dn_phys->dn_nblkptr); in dnode_sync_free_range_impl()
408 rw_enter(&dn->dn_struct_rwlock, RW_READER); in dnode_sync_free_range_impl()
409 VERIFY0(dbuf_hold_impl(dn, dnlevel - 1, i, in dnode_sync_free_range_impl()
411 rw_exit(&dn->dn_struct_rwlock); in dnode_sync_free_range_impl()
431 if (trunc && !dn->dn_objset->os_raw_receive) { in dnode_sync_free_range_impl()
433 dn->dn_phys->dn_maxblkid = blkid == 0 ? 0 : blkid - 1; in dnode_sync_free_range_impl()
435 off = (dn->dn_phys->dn_maxblkid + 1) * in dnode_sync_free_range_impl()
436 (dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT); in dnode_sync_free_range_impl()
437 ASSERT(off < dn->dn_phys->dn_maxblkid || in dnode_sync_free_range_impl()
438 dn->dn_phys->dn_maxblkid == 0 || in dnode_sync_free_range_impl()
453 dnode_t *dn = dsfra->dsfra_dnode; in dnode_sync_free_range()
455 mutex_exit(&dn->dn_mtx); in dnode_sync_free_range()
457 dsfra->dsfra_free_indirects, dsfra->dsfra_tx); in dnode_sync_free_range()
458 mutex_enter(&dn->dn_mtx); in dnode_sync_free_range()
472 mutex_enter(&dn->dn_dbufs_mtx); in dnode_evict_dbufs()
473 for (db = avl_first(&dn->dn_dbufs); db != NULL; db = db_next) { in dnode_evict_dbufs()
481 mutex_enter(&db->db_mtx); in dnode_evict_dbufs()
482 if (db->db_state != DB_EVICTING && in dnode_evict_dbufs()
483 zfs_refcount_is_zero(&db->db_holds)) { in dnode_evict_dbufs()
484 db_marker->db_level = db->db_level; in dnode_evict_dbufs()
485 db_marker->db_blkid = db->db_blkid; in dnode_evict_dbufs()
492 db_marker->db_state = DB_MARKER; in dnode_evict_dbufs()
493 db_marker->db_parent = (void *)((uintptr_t)db - 1); in dnode_evict_dbufs()
494 avl_insert_here(&dn->dn_dbufs, db_marker, db, in dnode_evict_dbufs()
512 db_next = AVL_NEXT(&dn->dn_dbufs, db_marker); in dnode_evict_dbufs()
513 avl_remove(&dn->dn_dbufs, db_marker); in dnode_evict_dbufs()
515 db->db_pending_evict = TRUE; in dnode_evict_dbufs()
516 db->db_partial_read = FALSE; in dnode_evict_dbufs()
517 mutex_exit(&db->db_mtx); in dnode_evict_dbufs()
518 db_next = AVL_NEXT(&dn->dn_dbufs, db); in dnode_evict_dbufs()
521 mutex_exit(&dn->dn_dbufs_mtx); in dnode_evict_dbufs()
531 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_evict_bonus()
532 if (dn->dn_bonus != NULL) { in dnode_evict_bonus()
533 if (zfs_refcount_is_zero(&dn->dn_bonus->db_holds)) { in dnode_evict_bonus()
534 mutex_enter(&dn->dn_bonus->db_mtx); in dnode_evict_bonus()
535 dbuf_destroy(dn->dn_bonus); in dnode_evict_bonus()
536 dn->dn_bonus = NULL; in dnode_evict_bonus()
538 dn->dn_bonus->db_pending_evict = TRUE; in dnode_evict_bonus()
541 rw_exit(&dn->dn_struct_rwlock); in dnode_evict_bonus()
550 dmu_buf_impl_t *db = dr->dr_dbuf; in dnode_undirty_dbufs()
551 uint64_t txg = dr->dr_txg; in dnode_undirty_dbufs()
553 if (db->db_level != 0) in dnode_undirty_dbufs()
554 dnode_undirty_dbufs(&dr->dt.di.dr_children); in dnode_undirty_dbufs()
556 mutex_enter(&db->db_mtx); in dnode_undirty_dbufs()
557 /* XXX - use dbuf_undirty()? */ in dnode_undirty_dbufs()
559 ASSERT(list_head(&db->db_dirty_records) == dr); in dnode_undirty_dbufs()
560 list_remove_head(&db->db_dirty_records); in dnode_undirty_dbufs()
561 ASSERT(list_is_empty(&db->db_dirty_records)); in dnode_undirty_dbufs()
562 db->db_dirtycnt -= 1; in dnode_undirty_dbufs()
563 if (db->db_level == 0) { in dnode_undirty_dbufs()
564 ASSERT(db->db_blkid == DMU_BONUS_BLKID || in dnode_undirty_dbufs()
565 dr->dt.dl.dr_data == db->db_buf); in dnode_undirty_dbufs()
568 mutex_destroy(&dr->dt.di.dr_mtx); in dnode_undirty_dbufs()
569 list_destroy(&dr->dt.di.dr_children); in dnode_undirty_dbufs()
579 int txgoff = tx->tx_txg & TXG_MASK; in dnode_sync_free()
587 ASSERT0(DN_USED_BYTES(dn->dn_phys)); in dnode_sync_free()
588 ASSERT(BP_IS_HOLE(dn->dn_phys->dn_blkptr)); in dnode_sync_free()
590 dnode_undirty_dbufs(&dn->dn_dirty_records[txgoff]); in dnode_sync_free()
594 * XXX - It would be nice to assert this, but we may still in dnode_sync_free()
600 * ASSERT3U(zfs_refcount_count(&dn->dn_holds), ==, 1); in dnode_sync_free()
604 dn->dn_next_nlevels[txgoff] = 0; in dnode_sync_free()
605 dn->dn_next_indblkshift[txgoff] = 0; in dnode_sync_free()
606 dn->dn_next_blksz[txgoff] = 0; in dnode_sync_free()
607 dn->dn_next_maxblkid[txgoff] = 0; in dnode_sync_free()
610 ASSERT(dn->dn_phys->dn_type != DMU_OT_NONE); in dnode_sync_free()
611 ASSERT(dn->dn_type != DMU_OT_NONE); in dnode_sync_free()
613 ASSERT(dn->dn_free_txg > 0); in dnode_sync_free()
614 if (dn->dn_allocated_txg != dn->dn_free_txg) in dnode_sync_free()
615 dmu_buf_will_dirty(&dn->dn_dbuf->db, tx); in dnode_sync_free()
616 memset(dn->dn_phys, 0, sizeof (dnode_phys_t) * dn->dn_num_slots); in dnode_sync_free()
619 mutex_enter(&dn->dn_mtx); in dnode_sync_free()
620 dn->dn_type = DMU_OT_NONE; in dnode_sync_free()
621 dn->dn_maxblkid = 0; in dnode_sync_free()
622 dn->dn_allocated_txg = 0; in dnode_sync_free()
623 dn->dn_free_txg = 0; in dnode_sync_free()
624 dn->dn_have_spill = B_FALSE; in dnode_sync_free()
625 dn->dn_num_slots = 1; in dnode_sync_free()
626 mutex_exit(&dn->dn_mtx); in dnode_sync_free()
628 ASSERT(dn->dn_object != DMU_META_DNODE_OBJECT); in dnode_sync_free()
630 dnode_rele(dn, (void *)(uintptr_t)tx->tx_txg); in dnode_sync_free()
644 objset_t *os = dn->dn_objset; in dnode_sync() local
645 dnode_phys_t *dnp = dn->dn_phys; in dnode_sync()
646 int txgoff = tx->tx_txg & TXG_MASK; in dnode_sync()
647 list_t *list = &dn->dn_dirty_records[txgoff]; in dnode_sync()
652 ASSERT(dnp->dn_type != DMU_OT_NONE || dn->dn_allocated_txg); in dnode_sync()
653 ASSERT(dnp->dn_type != DMU_OT_NONE || in dnode_sync()
657 ASSERT(dn->dn_dbuf == NULL || arc_released(dn->dn_dbuf->db_buf)); in dnode_sync()
663 if (dmu_objset_userused_enabled(os) && in dnode_sync()
664 !DMU_OBJECT_IS_SPECIAL(dn->dn_object) && in dnode_sync()
665 (!os->os_encrypted || !dmu_objset_is_receiving(os))) { in dnode_sync()
666 mutex_enter(&dn->dn_mtx); in dnode_sync()
667 dn->dn_oldused = DN_USED_BYTES(dn->dn_phys); in dnode_sync()
668 dn->dn_oldflags = dn->dn_phys->dn_flags; in dnode_sync()
669 dn->dn_phys->dn_flags |= DNODE_FLAG_USERUSED_ACCOUNTED; in dnode_sync()
670 if (dmu_objset_userobjused_enabled(dn->dn_objset)) in dnode_sync()
671 dn->dn_phys->dn_flags |= in dnode_sync()
673 mutex_exit(&dn->dn_mtx); in dnode_sync()
675 } else if (!(os->os_encrypted && dmu_objset_is_receiving(os))) { in dnode_sync()
682 ASSERT(!(dn->dn_phys->dn_flags & in dnode_sync()
684 ASSERT(!(dn->dn_phys->dn_flags & in dnode_sync()
688 mutex_enter(&dn->dn_mtx); in dnode_sync()
689 if (dn->dn_allocated_txg == tx->tx_txg) { in dnode_sync()
691 if (dnp->dn_type == DMU_OT_NONE) { in dnode_sync()
693 dnp->dn_nlevels = 1; in dnode_sync()
694 dnp->dn_nblkptr = dn->dn_nblkptr; in dnode_sync()
697 dnp->dn_type = dn->dn_type; in dnode_sync()
698 dnp->dn_bonustype = dn->dn_bonustype; in dnode_sync()
699 dnp->dn_bonuslen = dn->dn_bonuslen; in dnode_sync()
702 dnp->dn_extra_slots = dn->dn_num_slots - 1; in dnode_sync()
704 ASSERT(dnp->dn_nlevels > 1 || in dnode_sync()
705 BP_IS_HOLE(&dnp->dn_blkptr[0]) || in dnode_sync()
706 BP_IS_EMBEDDED(&dnp->dn_blkptr[0]) || in dnode_sync()
707 BP_GET_LSIZE(&dnp->dn_blkptr[0]) == in dnode_sync()
708 dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT); in dnode_sync()
709 ASSERT(dnp->dn_nlevels < 2 || in dnode_sync()
710 BP_IS_HOLE(&dnp->dn_blkptr[0]) || in dnode_sync()
711 BP_GET_LSIZE(&dnp->dn_blkptr[0]) == 1 << dnp->dn_indblkshift); in dnode_sync()
713 if (dn->dn_next_type[txgoff] != 0) { in dnode_sync()
714 dnp->dn_type = dn->dn_type; in dnode_sync()
715 dn->dn_next_type[txgoff] = 0; in dnode_sync()
718 if (dn->dn_next_blksz[txgoff] != 0) { in dnode_sync()
719 ASSERT(P2PHASE(dn->dn_next_blksz[txgoff], in dnode_sync()
721 ASSERT(BP_IS_HOLE(&dnp->dn_blkptr[0]) || in dnode_sync()
722 dn->dn_maxblkid == 0 || list_head(list) != NULL || in dnode_sync()
723 dn->dn_next_blksz[txgoff] >> SPA_MINBLOCKSHIFT == in dnode_sync()
724 dnp->dn_datablkszsec || in dnode_sync()
725 !zfs_range_tree_is_empty(dn->dn_free_ranges[txgoff])); in dnode_sync()
726 dnp->dn_datablkszsec = in dnode_sync()
727 dn->dn_next_blksz[txgoff] >> SPA_MINBLOCKSHIFT; in dnode_sync()
728 dn->dn_next_blksz[txgoff] = 0; in dnode_sync()
731 if (dn->dn_next_bonuslen[txgoff] != 0) { in dnode_sync()
732 if (dn->dn_next_bonuslen[txgoff] == DN_ZERO_BONUSLEN) in dnode_sync()
733 dnp->dn_bonuslen = 0; in dnode_sync()
735 dnp->dn_bonuslen = dn->dn_next_bonuslen[txgoff]; in dnode_sync()
736 ASSERT(dnp->dn_bonuslen <= in dnode_sync()
737 DN_SLOTS_TO_BONUSLEN(dnp->dn_extra_slots + 1)); in dnode_sync()
738 dn->dn_next_bonuslen[txgoff] = 0; in dnode_sync()
741 if (dn->dn_next_bonustype[txgoff] != 0) { in dnode_sync()
742 ASSERT(DMU_OT_IS_VALID(dn->dn_next_bonustype[txgoff])); in dnode_sync()
743 dnp->dn_bonustype = dn->dn_next_bonustype[txgoff]; in dnode_sync()
744 dn->dn_next_bonustype[txgoff] = 0; in dnode_sync()
747 boolean_t freeing_dnode = dn->dn_free_txg > 0 && in dnode_sync()
748 dn->dn_free_txg <= tx->tx_txg; in dnode_sync()
754 if (dn->dn_rm_spillblk[txgoff] || freeing_dnode) { in dnode_sync()
755 if (dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) in dnode_sync()
757 dn->dn_rm_spillblk[txgoff] = 0; in dnode_sync()
760 if (dn->dn_next_indblkshift[txgoff] != 0) { in dnode_sync()
761 ASSERT(dnp->dn_nlevels == 1); in dnode_sync()
762 dnp->dn_indblkshift = dn->dn_next_indblkshift[txgoff]; in dnode_sync()
763 dn->dn_next_indblkshift[txgoff] = 0; in dnode_sync()
767 * Just take the live (open-context) values for checksum and compress. in dnode_sync()
771 dnp->dn_checksum = dn->dn_checksum; in dnode_sync()
772 dnp->dn_compress = dn->dn_compress; in dnode_sync()
774 mutex_exit(&dn->dn_mtx); in dnode_sync()
777 free_blocks(dn, DN_SPILL_BLKPTR(dn->dn_phys), 1, tx); in dnode_sync()
778 mutex_enter(&dn->dn_mtx); in dnode_sync()
779 dnp->dn_flags &= ~DNODE_FLAG_SPILL_BLKPTR; in dnode_sync()
780 mutex_exit(&dn->dn_mtx); in dnode_sync()
784 if (dn->dn_free_ranges[txgoff] != NULL) { in dnode_sync()
789 mutex_enter(&dn->dn_mtx); in dnode_sync()
792 dn->dn_free_ranges[txgoff], 0, in dnode_sync()
793 dn->dn_maxblkid + 1)); in dnode_sync()
803 zfs_range_tree_walk(dn->dn_free_ranges[txgoff], in dnode_sync()
805 zfs_range_tree_vacate(dn->dn_free_ranges[txgoff], NULL, NULL); in dnode_sync()
806 zfs_range_tree_destroy(dn->dn_free_ranges[txgoff]); in dnode_sync()
807 dn->dn_free_ranges[txgoff] = NULL; in dnode_sync()
808 mutex_exit(&dn->dn_mtx); in dnode_sync()
812 dn->dn_objset->os_freed_dnodes++; in dnode_sync()
817 if (dn->dn_num_slots > DNODE_MIN_SLOTS) { in dnode_sync()
818 dsl_dataset_t *ds = dn->dn_objset->os_dsl_dataset; in dnode_sync()
819 mutex_enter(&ds->ds_lock); in dnode_sync()
820 ds->ds_feature_activation[SPA_FEATURE_LARGE_DNODE] = in dnode_sync()
822 mutex_exit(&ds->ds_lock); in dnode_sync()
825 if (dn->dn_next_nlevels[txgoff]) { in dnode_sync()
827 dn->dn_next_nlevels[txgoff] = 0; in dnode_sync()
835 if (dn->dn_next_maxblkid[txgoff]) { in dnode_sync()
836 mutex_enter(&dn->dn_mtx); in dnode_sync()
837 dnp->dn_maxblkid = in dnode_sync()
838 dn->dn_next_maxblkid[txgoff] & ~DMU_NEXT_MAXBLKID_SET; in dnode_sync()
839 dn->dn_next_maxblkid[txgoff] = 0; in dnode_sync()
840 mutex_exit(&dn->dn_mtx); in dnode_sync()
843 if (dn->dn_next_nblkptr[txgoff]) { in dnode_sync()
845 ASSERT(dn->dn_allocated_txg == tx->tx_txg); in dnode_sync()
846 if (dn->dn_next_nblkptr[txgoff] > dnp->dn_nblkptr) { in dnode_sync()
848 memset(dnp->dn_blkptr + dnp->dn_nblkptr, 0, in dnode_sync()
850 (dn->dn_next_nblkptr[txgoff] - dnp->dn_nblkptr)); in dnode_sync()
854 ASSERT(dn->dn_next_nblkptr[txgoff] < dnp->dn_nblkptr); in dnode_sync()
856 for (i = 0; i < dnp->dn_nblkptr; i++) { in dnode_sync()
857 if (i >= dn->dn_next_nblkptr[txgoff]) in dnode_sync()
858 ASSERT(BP_IS_HOLE(&dnp->dn_blkptr[i])); in dnode_sync()
862 mutex_enter(&dn->dn_mtx); in dnode_sync()
863 dnp->dn_nblkptr = dn->dn_next_nblkptr[txgoff]; in dnode_sync()
864 dn->dn_next_nblkptr[txgoff] = 0; in dnode_sync()
865 mutex_exit(&dn->dn_mtx); in dnode_sync()
868 dbuf_sync_list(list, dn->dn_phys->dn_nlevels - 1, tx); in dnode_sync()
870 if (!DMU_OBJECT_IS_SPECIAL(dn->dn_object)) { in dnode_sync()
872 dnode_rele(dn, (void *)(uintptr_t)tx->tx_txg); in dnode_sync()
875 ASSERT3U(dnp->dn_bonuslen, <=, DN_MAX_BONUS_LEN(dnp)); in dnode_sync()
880 * initiated the IO for the dnode's dbuf. Additionally, the caller in dnode_sync()