Lines Matching full:dn

125 	dnode_t *dn = arg;  in dnode_cons()  local
127 rw_init(&dn->dn_struct_rwlock, NULL, RW_NOLOCKDEP, NULL); in dnode_cons()
128 mutex_init(&dn->dn_mtx, NULL, MUTEX_DEFAULT, NULL); in dnode_cons()
129 mutex_init(&dn->dn_dbufs_mtx, NULL, MUTEX_DEFAULT, NULL); in dnode_cons()
130 cv_init(&dn->dn_notxholds, NULL, CV_DEFAULT, NULL); in dnode_cons()
131 cv_init(&dn->dn_nodnholds, NULL, CV_DEFAULT, NULL); in dnode_cons()
137 zfs_refcount_create_untracked(&dn->dn_holds); in dnode_cons()
138 zfs_refcount_create(&dn->dn_tx_holds); in dnode_cons()
139 list_link_init(&dn->dn_link); in dnode_cons()
141 memset(dn->dn_next_type, 0, sizeof (dn->dn_next_type)); in dnode_cons()
142 memset(dn->dn_next_nblkptr, 0, sizeof (dn->dn_next_nblkptr)); in dnode_cons()
143 memset(dn->dn_next_nlevels, 0, sizeof (dn->dn_next_nlevels)); in dnode_cons()
144 memset(dn->dn_next_indblkshift, 0, sizeof (dn->dn_next_indblkshift)); in dnode_cons()
145 memset(dn->dn_next_bonustype, 0, sizeof (dn->dn_next_bonustype)); in dnode_cons()
146 memset(dn->dn_rm_spillblk, 0, sizeof (dn->dn_rm_spillblk)); in dnode_cons()
147 memset(dn->dn_next_bonuslen, 0, sizeof (dn->dn_next_bonuslen)); in dnode_cons()
148 memset(dn->dn_next_blksz, 0, sizeof (dn->dn_next_blksz)); in dnode_cons()
149 memset(dn->dn_next_maxblkid, 0, sizeof (dn->dn_next_maxblkid)); in dnode_cons()
152 multilist_link_init(&dn->dn_dirty_link[i]); in dnode_cons()
153 dn->dn_free_ranges[i] = NULL; in dnode_cons()
154 list_create(&dn->dn_dirty_records[i], in dnode_cons()
159 dn->dn_allocated_txg = 0; in dnode_cons()
160 dn->dn_free_txg = 0; in dnode_cons()
161 dn->dn_assigned_txg = 0; in dnode_cons()
162 dn->dn_dirty_txg = 0; in dnode_cons()
163 dn->dn_dirtyctx = 0; in dnode_cons()
164 dn->dn_dirtyctx_firstset = NULL; in dnode_cons()
165 dn->dn_bonus = NULL; in dnode_cons()
166 dn->dn_have_spill = B_FALSE; in dnode_cons()
167 dn->dn_zio = NULL; in dnode_cons()
168 dn->dn_oldused = 0; in dnode_cons()
169 dn->dn_oldflags = 0; in dnode_cons()
170 dn->dn_olduid = 0; in dnode_cons()
171 dn->dn_oldgid = 0; in dnode_cons()
172 dn->dn_oldprojid = ZFS_DEFAULT_PROJID; in dnode_cons()
173 dn->dn_newuid = 0; in dnode_cons()
174 dn->dn_newgid = 0; in dnode_cons()
175 dn->dn_newprojid = ZFS_DEFAULT_PROJID; in dnode_cons()
176 dn->dn_id_flags = 0; in dnode_cons()
178 dn->dn_dbufs_count = 0; in dnode_cons()
179 avl_create(&dn->dn_dbufs, dbuf_compare, sizeof (dmu_buf_impl_t), in dnode_cons()
182 dn->dn_moved = 0; in dnode_cons()
190 dnode_t *dn = arg; in dnode_dest() local
192 rw_destroy(&dn->dn_struct_rwlock); in dnode_dest()
193 mutex_destroy(&dn->dn_mtx); in dnode_dest()
194 mutex_destroy(&dn->dn_dbufs_mtx); in dnode_dest()
195 cv_destroy(&dn->dn_notxholds); in dnode_dest()
196 cv_destroy(&dn->dn_nodnholds); in dnode_dest()
197 zfs_refcount_destroy(&dn->dn_holds); in dnode_dest()
198 zfs_refcount_destroy(&dn->dn_tx_holds); in dnode_dest()
199 ASSERT(!list_link_active(&dn->dn_link)); in dnode_dest()
202 ASSERT(!multilist_link_active(&dn->dn_dirty_link[i])); in dnode_dest()
203 ASSERT3P(dn->dn_free_ranges[i], ==, NULL); in dnode_dest()
204 list_destroy(&dn->dn_dirty_records[i]); in dnode_dest()
205 ASSERT0(dn->dn_next_nblkptr[i]); in dnode_dest()
206 ASSERT0(dn->dn_next_nlevels[i]); in dnode_dest()
207 ASSERT0(dn->dn_next_indblkshift[i]); in dnode_dest()
208 ASSERT0(dn->dn_next_bonustype[i]); in dnode_dest()
209 ASSERT0(dn->dn_rm_spillblk[i]); in dnode_dest()
210 ASSERT0(dn->dn_next_bonuslen[i]); in dnode_dest()
211 ASSERT0(dn->dn_next_blksz[i]); in dnode_dest()
212 ASSERT0(dn->dn_next_maxblkid[i]); in dnode_dest()
215 ASSERT0(dn->dn_allocated_txg); in dnode_dest()
216 ASSERT0(dn->dn_free_txg); in dnode_dest()
217 ASSERT0(dn->dn_assigned_txg); in dnode_dest()
218 ASSERT0(dn->dn_dirty_txg); in dnode_dest()
219 ASSERT0(dn->dn_dirtyctx); in dnode_dest()
220 ASSERT3P(dn->dn_dirtyctx_firstset, ==, NULL); in dnode_dest()
221 ASSERT3P(dn->dn_bonus, ==, NULL); in dnode_dest()
222 ASSERT(!dn->dn_have_spill); in dnode_dest()
223 ASSERT3P(dn->dn_zio, ==, NULL); in dnode_dest()
224 ASSERT0(dn->dn_oldused); in dnode_dest()
225 ASSERT0(dn->dn_oldflags); in dnode_dest()
226 ASSERT0(dn->dn_olduid); in dnode_dest()
227 ASSERT0(dn->dn_oldgid); in dnode_dest()
228 ASSERT0(dn->dn_oldprojid); in dnode_dest()
229 ASSERT0(dn->dn_newuid); in dnode_dest()
230 ASSERT0(dn->dn_newgid); in dnode_dest()
231 ASSERT0(dn->dn_newprojid); in dnode_dest()
232 ASSERT0(dn->dn_id_flags); in dnode_dest()
234 ASSERT0(dn->dn_dbufs_count); in dnode_dest()
235 avl_destroy(&dn->dn_dbufs); in dnode_dest()
395 dnode_verify(dnode_t *dn) in dnode_verify() argument
399 ASSERT(dn->dn_phys); in dnode_verify()
400 ASSERT(dn->dn_objset); in dnode_verify()
401 ASSERT(dn->dn_handle->dnh_dnode == dn); in dnode_verify()
403 ASSERT(DMU_OT_IS_VALID(dn->dn_phys->dn_type)); in dnode_verify()
408 if (!RW_WRITE_HELD(&dn->dn_struct_rwlock)) { in dnode_verify()
409 rw_enter(&dn->dn_struct_rwlock, RW_READER); in dnode_verify()
412 if (dn->dn_phys->dn_type != DMU_OT_NONE || dn->dn_allocated_txg != 0) { in dnode_verify()
414 int max_bonuslen = DN_SLOTS_TO_BONUSLEN(dn->dn_num_slots); in dnode_verify()
415 ASSERT3U(dn->dn_indblkshift, <=, SPA_MAXBLOCKSHIFT); in dnode_verify()
416 if (dn->dn_datablkshift) { in dnode_verify()
417 ASSERT3U(dn->dn_datablkshift, >=, SPA_MINBLOCKSHIFT); in dnode_verify()
418 ASSERT3U(dn->dn_datablkshift, <=, SPA_MAXBLOCKSHIFT); in dnode_verify()
419 ASSERT3U(1<<dn->dn_datablkshift, ==, dn->dn_datablksz); in dnode_verify()
421 ASSERT3U(dn->dn_nlevels, <=, 30); in dnode_verify()
422 ASSERT(DMU_OT_IS_VALID(dn->dn_type)); in dnode_verify()
423 ASSERT3U(dn->dn_nblkptr, >=, 1); in dnode_verify()
424 ASSERT3U(dn->dn_nblkptr, <=, DN_MAX_NBLKPTR); in dnode_verify()
425 ASSERT3U(dn->dn_bonuslen, <=, max_bonuslen); in dnode_verify()
426 ASSERT3U(dn->dn_datablksz, ==, in dnode_verify()
427 dn->dn_datablkszsec << SPA_MINBLOCKSHIFT); in dnode_verify()
428 ASSERT3U(ISP2(dn->dn_datablksz), ==, dn->dn_datablkshift != 0); in dnode_verify()
429 ASSERT3U((dn->dn_nblkptr - 1) * sizeof (blkptr_t) + in dnode_verify()
430 dn->dn_bonuslen, <=, max_bonuslen); in dnode_verify()
432 ASSERT3U(dn->dn_next_nlevels[i], <=, dn->dn_nlevels); in dnode_verify()
435 if (dn->dn_phys->dn_type != DMU_OT_NONE) in dnode_verify()
436 ASSERT3U(dn->dn_phys->dn_nlevels, <=, dn->dn_nlevels); in dnode_verify()
437 ASSERT(DMU_OBJECT_IS_SPECIAL(dn->dn_object) || dn->dn_dbuf != NULL); in dnode_verify()
438 if (dn->dn_dbuf != NULL) { in dnode_verify()
439 ASSERT3P(dn->dn_phys, ==, in dnode_verify()
440 (dnode_phys_t *)dn->dn_dbuf->db.db_data + in dnode_verify()
441 (dn->dn_object % (dn->dn_dbuf->db.db_size >> DNODE_SHIFT))); in dnode_verify()
444 rw_exit(&dn->dn_struct_rwlock); in dnode_verify()
511 dnode_setbonuslen(dnode_t *dn, int newsize, dmu_tx_t *tx) in dnode_setbonuslen() argument
513 ASSERT3U(zfs_refcount_count(&dn->dn_holds), >=, 1); in dnode_setbonuslen()
515 dnode_setdirty(dn, tx); in dnode_setbonuslen()
516 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_setbonuslen()
517 ASSERT3U(newsize, <=, DN_SLOTS_TO_BONUSLEN(dn->dn_num_slots) - in dnode_setbonuslen()
518 (dn->dn_nblkptr-1) * sizeof (blkptr_t)); in dnode_setbonuslen()
520 if (newsize < dn->dn_bonuslen) { in dnode_setbonuslen()
522 size_t diff = dn->dn_bonuslen - newsize; in dnode_setbonuslen()
523 char *data_end = ((char *)dn->dn_bonus->db.db_data) + newsize; in dnode_setbonuslen()
527 dn->dn_bonuslen = newsize; in dnode_setbonuslen()
529 dn->dn_next_bonuslen[tx->tx_txg & TXG_MASK] = DN_ZERO_BONUSLEN; in dnode_setbonuslen()
531 dn->dn_next_bonuslen[tx->tx_txg & TXG_MASK] = dn->dn_bonuslen; in dnode_setbonuslen()
532 rw_exit(&dn->dn_struct_rwlock); in dnode_setbonuslen()
536 dnode_setbonus_type(dnode_t *dn, dmu_object_type_t newtype, dmu_tx_t *tx) in dnode_setbonus_type() argument
538 ASSERT3U(zfs_refcount_count(&dn->dn_holds), >=, 1); in dnode_setbonus_type()
539 dnode_setdirty(dn, tx); in dnode_setbonus_type()
540 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_setbonus_type()
541 dn->dn_bonustype = newtype; in dnode_setbonus_type()
542 dn->dn_next_bonustype[tx->tx_txg & TXG_MASK] = dn->dn_bonustype; in dnode_setbonus_type()
543 rw_exit(&dn->dn_struct_rwlock); in dnode_setbonus_type()
547 dnode_set_storage_type(dnode_t *dn, dmu_object_type_t newtype) in dnode_set_storage_type() argument
553 ASSERT3U(zfs_refcount_count(&dn->dn_holds), >=, 1); in dnode_set_storage_type()
554 dn->dn_storage_type = newtype; in dnode_set_storage_type()
558 dnode_rm_spill(dnode_t *dn, dmu_tx_t *tx) in dnode_rm_spill() argument
560 ASSERT3U(zfs_refcount_count(&dn->dn_holds), >=, 1); in dnode_rm_spill()
561 ASSERT(RW_WRITE_HELD(&dn->dn_struct_rwlock)); in dnode_rm_spill()
562 dnode_setdirty(dn, tx); in dnode_rm_spill()
563 dn->dn_rm_spillblk[tx->tx_txg & TXG_MASK] = DN_KILL_SPILLBLK; in dnode_rm_spill()
564 dn->dn_have_spill = B_FALSE; in dnode_rm_spill()
568 dnode_setdblksz(dnode_t *dn, int size) in dnode_setdblksz() argument
574 1<<(sizeof (dn->dn_phys->dn_datablkszsec) * 8)); in dnode_setdblksz()
575 dn->dn_datablksz = size; in dnode_setdblksz()
576 dn->dn_datablkszsec = size >> SPA_MINBLOCKSHIFT; in dnode_setdblksz()
577 dn->dn_datablkshift = ISP2(size) ? highbit64(size - 1) : 0; in dnode_setdblksz()
584 dnode_t *dn; in dnode_create() local
586 dn = kmem_cache_alloc(dnode_cache, KM_SLEEP); in dnode_create()
587 dn->dn_moved = 0; in dnode_create()
593 dn->dn_object = object; in dnode_create()
594 dn->dn_dbuf = db; in dnode_create()
595 dn->dn_handle = dnh; in dnode_create()
596 dn->dn_phys = dnp; in dnode_create()
599 dnode_setdblksz(dn, dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT); in dnode_create()
601 dn->dn_datablksz = 0; in dnode_create()
602 dn->dn_datablkszsec = 0; in dnode_create()
603 dn->dn_datablkshift = 0; in dnode_create()
605 dn->dn_indblkshift = dnp->dn_indblkshift; in dnode_create()
606 dn->dn_nlevels = dnp->dn_nlevels; in dnode_create()
607 dn->dn_type = dnp->dn_type; in dnode_create()
608 dn->dn_nblkptr = dnp->dn_nblkptr; in dnode_create()
609 dn->dn_checksum = dnp->dn_checksum; in dnode_create()
610 dn->dn_compress = dnp->dn_compress; in dnode_create()
611 dn->dn_bonustype = dnp->dn_bonustype; in dnode_create()
612 dn->dn_bonuslen = dnp->dn_bonuslen; in dnode_create()
613 dn->dn_num_slots = dnp->dn_extra_slots + 1; in dnode_create()
614 dn->dn_maxblkid = dnp->dn_maxblkid; in dnode_create()
615 dn->dn_have_spill = ((dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) != 0); in dnode_create()
616 dn->dn_id_flags = 0; in dnode_create()
618 dn->dn_storage_type = DMU_OT_NONE; in dnode_create()
620 dmu_zfetch_init(&dn->dn_zfetch, dn); in dnode_create()
622 ASSERT(DMU_OT_IS_VALID(dn->dn_phys->dn_type)); in dnode_create()
636 list_insert_head(&os->os_dnodes, dn); in dnode_create()
643 dn->dn_objset = os; in dnode_create()
645 dnh->dnh_dnode = dn; in dnode_create()
650 return (dn); in dnode_create()
657 dnode_destroy(dnode_t *dn) in dnode_destroy() argument
659 objset_t *os = dn->dn_objset; in dnode_destroy()
662 ASSERT((dn->dn_id_flags & DN_ID_NEW_EXIST) == 0); in dnode_destroy()
665 POINTER_INVALIDATE(&dn->dn_objset); in dnode_destroy()
666 if (!DMU_OBJECT_IS_SPECIAL(dn->dn_object)) { in dnode_destroy()
667 list_remove(&os->os_dnodes, dn); in dnode_destroy()
675 if (!zrl_is_locked(&dn->dn_handle->dnh_zrlock)) in dnode_destroy()
676 zrl_remove(&dn->dn_handle->dnh_zrlock); in dnode_destroy()
678 dn->dn_allocated_txg = 0; in dnode_destroy()
679 dn->dn_free_txg = 0; in dnode_destroy()
680 dn->dn_assigned_txg = 0; in dnode_destroy()
681 dn->dn_dirty_txg = 0; in dnode_destroy()
683 dn->dn_dirtyctx = 0; in dnode_destroy()
684 dn->dn_dirtyctx_firstset = NULL; in dnode_destroy()
685 if (dn->dn_bonus != NULL) { in dnode_destroy()
686 mutex_enter(&dn->dn_bonus->db_mtx); in dnode_destroy()
687 dbuf_destroy(dn->dn_bonus); in dnode_destroy()
688 dn->dn_bonus = NULL; in dnode_destroy()
690 dn->dn_zio = NULL; in dnode_destroy()
692 dn->dn_have_spill = B_FALSE; in dnode_destroy()
693 dn->dn_oldused = 0; in dnode_destroy()
694 dn->dn_oldflags = 0; in dnode_destroy()
695 dn->dn_olduid = 0; in dnode_destroy()
696 dn->dn_oldgid = 0; in dnode_destroy()
697 dn->dn_oldprojid = ZFS_DEFAULT_PROJID; in dnode_destroy()
698 dn->dn_newuid = 0; in dnode_destroy()
699 dn->dn_newgid = 0; in dnode_destroy()
700 dn->dn_newprojid = ZFS_DEFAULT_PROJID; in dnode_destroy()
701 dn->dn_id_flags = 0; in dnode_destroy()
703 dn->dn_storage_type = DMU_OT_NONE; in dnode_destroy()
705 dmu_zfetch_fini(&dn->dn_zfetch); in dnode_destroy()
706 kmem_cache_free(dnode_cache, dn); in dnode_destroy()
714 dnode_allocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, int ibs, in dnode_allocate() argument
721 spa_maxdnodesize(dmu_objset_spa(dn->dn_objset))); in dnode_allocate()
723 spa_maxblocksize(dmu_objset_spa(dn->dn_objset))); in dnode_allocate()
735 dn->dn_objset, (u_longlong_t)dn->dn_object, in dnode_allocate()
739 ASSERT(dn->dn_type == DMU_OT_NONE); in dnode_allocate()
740 ASSERT0(memcmp(dn->dn_phys, &dnode_phys_zero, sizeof (dnode_phys_t))); in dnode_allocate()
741 ASSERT(dn->dn_phys->dn_type == DMU_OT_NONE); in dnode_allocate()
750 ASSERT(dn->dn_type == DMU_OT_NONE); in dnode_allocate()
751 ASSERT0(dn->dn_maxblkid); in dnode_allocate()
752 ASSERT0(dn->dn_allocated_txg); in dnode_allocate()
753 ASSERT0(dn->dn_assigned_txg); in dnode_allocate()
754 ASSERT(zfs_refcount_is_zero(&dn->dn_tx_holds)); in dnode_allocate()
755 ASSERT3U(zfs_refcount_count(&dn->dn_holds), <=, 1); in dnode_allocate()
756 ASSERT(avl_is_empty(&dn->dn_dbufs)); in dnode_allocate()
759 ASSERT0(dn->dn_next_nblkptr[i]); in dnode_allocate()
760 ASSERT0(dn->dn_next_nlevels[i]); in dnode_allocate()
761 ASSERT0(dn->dn_next_indblkshift[i]); in dnode_allocate()
762 ASSERT0(dn->dn_next_bonuslen[i]); in dnode_allocate()
763 ASSERT0(dn->dn_next_bonustype[i]); in dnode_allocate()
764 ASSERT0(dn->dn_rm_spillblk[i]); in dnode_allocate()
765 ASSERT0(dn->dn_next_blksz[i]); in dnode_allocate()
766 ASSERT0(dn->dn_next_maxblkid[i]); in dnode_allocate()
767 ASSERT(!multilist_link_active(&dn->dn_dirty_link[i])); in dnode_allocate()
768 ASSERT3P(list_head(&dn->dn_dirty_records[i]), ==, NULL); in dnode_allocate()
769 ASSERT3P(dn->dn_free_ranges[i], ==, NULL); in dnode_allocate()
772 dn->dn_type = ot; in dnode_allocate()
773 dnode_setdblksz(dn, blocksize); in dnode_allocate()
774 dn->dn_indblkshift = ibs; in dnode_allocate()
775 dn->dn_nlevels = 1; in dnode_allocate()
776 dn->dn_num_slots = dn_slots; in dnode_allocate()
778 dn->dn_nblkptr = 1; in dnode_allocate()
780 dn->dn_nblkptr = MIN(DN_MAX_NBLKPTR, in dnode_allocate()
785 dn->dn_bonustype = bonustype; in dnode_allocate()
786 dn->dn_bonuslen = bonuslen; in dnode_allocate()
787 dn->dn_checksum = ZIO_CHECKSUM_INHERIT; in dnode_allocate()
788 dn->dn_compress = ZIO_COMPRESS_INHERIT; in dnode_allocate()
789 dn->dn_dirtyctx = 0; in dnode_allocate()
791 dn->dn_free_txg = 0; in dnode_allocate()
792 dn->dn_dirtyctx_firstset = NULL; in dnode_allocate()
793 dn->dn_dirty_txg = 0; in dnode_allocate()
795 dn->dn_allocated_txg = tx->tx_txg; in dnode_allocate()
796 dn->dn_id_flags = 0; in dnode_allocate()
798 dnode_setdirty(dn, tx); in dnode_allocate()
799 dn->dn_next_indblkshift[tx->tx_txg & TXG_MASK] = ibs; in dnode_allocate()
800 dn->dn_next_bonuslen[tx->tx_txg & TXG_MASK] = dn->dn_bonuslen; in dnode_allocate()
801 dn->dn_next_bonustype[tx->tx_txg & TXG_MASK] = dn->dn_bonustype; in dnode_allocate()
802 dn->dn_next_blksz[tx->tx_txg & TXG_MASK] = dn->dn_datablksz; in dnode_allocate()
806 dnode_reallocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, in dnode_reallocate() argument
814 spa_maxblocksize(dmu_objset_spa(dn->dn_objset))); in dnode_reallocate()
816 ASSERT(dn->dn_object != DMU_META_DNODE_OBJECT || dmu_tx_private_ok(tx)); in dnode_reallocate()
823 DN_BONUS_SIZE(spa_maxdnodesize(dmu_objset_spa(dn->dn_objset)))); in dnode_reallocate()
826 dnode_free_interior_slots(dn); in dnode_reallocate()
830 dnode_evict_dbufs(dn); in dnode_reallocate()
832 dn->dn_id_flags = 0; in dnode_reallocate()
834 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_reallocate()
835 dnode_setdirty(dn, tx); in dnode_reallocate()
836 if (dn->dn_datablksz != blocksize) { in dnode_reallocate()
838 ASSERT0(dn->dn_maxblkid); in dnode_reallocate()
839 ASSERT(BP_IS_HOLE(&dn->dn_phys->dn_blkptr[0]) || in dnode_reallocate()
840 dnode_block_freed(dn, 0)); in dnode_reallocate()
842 dnode_setdblksz(dn, blocksize); in dnode_reallocate()
843 dn->dn_next_blksz[tx->tx_txg & TXG_MASK] = blocksize; in dnode_reallocate()
845 if (dn->dn_bonuslen != bonuslen) in dnode_reallocate()
846 dn->dn_next_bonuslen[tx->tx_txg & TXG_MASK] = bonuslen; in dnode_reallocate()
854 if (dn->dn_bonustype != bonustype) in dnode_reallocate()
855 dn->dn_next_bonustype[tx->tx_txg & TXG_MASK] = bonustype; in dnode_reallocate()
856 if (dn->dn_nblkptr != nblkptr) in dnode_reallocate()
857 dn->dn_next_nblkptr[tx->tx_txg & TXG_MASK] = nblkptr; in dnode_reallocate()
858 if (dn->dn_phys->dn_flags & DNODE_FLAG_SPILL_BLKPTR && !keep_spill) { in dnode_reallocate()
859 dbuf_rm_spill(dn, tx); in dnode_reallocate()
860 dnode_rm_spill(dn, tx); in dnode_reallocate()
863 rw_exit(&dn->dn_struct_rwlock); in dnode_reallocate()
866 dn->dn_type = ot; in dnode_reallocate()
869 mutex_enter(&dn->dn_mtx); in dnode_reallocate()
870 dn->dn_bonustype = bonustype; in dnode_reallocate()
871 dn->dn_bonuslen = bonuslen; in dnode_reallocate()
872 dn->dn_num_slots = dn_slots; in dnode_reallocate()
873 dn->dn_nblkptr = nblkptr; in dnode_reallocate()
874 dn->dn_checksum = ZIO_CHECKSUM_INHERIT; in dnode_reallocate()
875 dn->dn_compress = ZIO_COMPRESS_INHERIT; in dnode_reallocate()
876 ASSERT3U(dn->dn_nblkptr, <=, DN_MAX_NBLKPTR); in dnode_reallocate()
879 if (dn->dn_bonus) { in dnode_reallocate()
880 dn->dn_bonus->db.db_size = in dnode_reallocate()
881 DN_SLOTS_TO_BONUSLEN(dn->dn_num_slots) - in dnode_reallocate()
882 (dn->dn_nblkptr-1) * sizeof (blkptr_t); in dnode_reallocate()
883 ASSERT(dn->dn_bonuslen <= dn->dn_bonus->db.db_size); in dnode_reallocate()
886 dn->dn_allocated_txg = tx->tx_txg; in dnode_reallocate()
887 mutex_exit(&dn->dn_mtx); in dnode_reallocate()
1255 dnode_t *dn = dnh->dnh_dnode; in dnode_check_slots_free() local
1257 if (dn == DN_SLOT_FREE) { in dnode_check_slots_free()
1259 } else if (DN_SLOT_IS_PTR(dn)) { in dnode_check_slots_free()
1260 mutex_enter(&dn->dn_mtx); in dnode_check_slots_free()
1261 boolean_t can_free = (dn->dn_type == DMU_OT_NONE && in dnode_check_slots_free()
1262 zfs_refcount_is_zero(&dn->dn_holds) && in dnode_check_slots_free()
1263 !DNODE_IS_DIRTY(dn)); in dnode_check_slots_free()
1264 mutex_exit(&dn->dn_mtx); in dnode_check_slots_free()
1302 dnode_free_interior_slots(dnode_t *dn) in dnode_free_interior_slots() argument
1304 dnode_children_t *children = dmu_buf_get_user(&dn->dn_dbuf->db); in dnode_free_interior_slots()
1305 int epb = dn->dn_dbuf->db.db_size >> DNODE_SHIFT; in dnode_free_interior_slots()
1306 int idx = (dn->dn_object & (epb - 1)) + 1; in dnode_free_interior_slots()
1307 int slots = dn->dn_num_slots - 1; in dnode_free_interior_slots()
1326 dnode_t *dn = dnh->dnh_dnode; in dnode_special_close() local
1332 mutex_enter(&dn->dn_mtx); in dnode_special_close()
1333 if (zfs_refcount_count(&dn->dn_holds) > 0) in dnode_special_close()
1334 cv_wait(&dn->dn_nodnholds, &dn->dn_mtx); in dnode_special_close()
1335 mutex_exit(&dn->dn_mtx); in dnode_special_close()
1336 ASSERT3U(zfs_refcount_count(&dn->dn_holds), ==, 0); in dnode_special_close()
1338 ASSERT(dn->dn_dbuf == NULL || in dnode_special_close()
1339 dmu_buf_get_user(&dn->dn_dbuf->db) == NULL); in dnode_special_close()
1341 dnode_destroy(dn); /* implicit zrl_remove() */ in dnode_special_close()
1350 dnode_t *dn; in dnode_special_open() local
1355 dn = dnode_create(os, dnp, NULL, object, dnh); in dnode_special_open()
1356 DNODE_VERIFY(dn); in dnode_special_open()
1370 dnode_t *dn; in dnode_buf_evict_async() local
1384 dn = dnh->dnh_dnode; in dnode_buf_evict_async()
1391 ASSERT(zfs_refcount_is_zero(&dn->dn_holds)); in dnode_buf_evict_async()
1392 ASSERT(zfs_refcount_is_zero(&dn->dn_tx_holds)); in dnode_buf_evict_async()
1394 dnode_destroy(dn); /* implicit zrl_remove() for first slot */ in dnode_buf_evict_async()
1439 dnode_t *mdn, *dn; in dnode_hold_impl() local
1464 dn = DMU_USERUSED_DNODE(os); in dnode_hold_impl()
1466 dn = DMU_GROUPUSED_DNODE(os); in dnode_hold_impl()
1468 dn = DMU_PROJECTUSED_DNODE(os); in dnode_hold_impl()
1469 if (dn == NULL) in dnode_hold_impl()
1471 type = dn->dn_type; in dnode_hold_impl()
1476 DNODE_VERIFY(dn); in dnode_hold_impl()
1479 (void) zfs_refcount_add(&dn->dn_holds, tag); in dnode_hold_impl()
1480 *dnp = dn; in dnode_hold_impl()
1582 dn = dnh->dnh_dnode; in dnode_hold_impl()
1607 dn = dnh->dnh_dnode; in dnode_hold_impl()
1609 dn = dnode_create(os, dn_block + idx, db, in dnode_hold_impl()
1616 mutex_enter(&dn->dn_mtx); in dnode_hold_impl()
1617 if (dn->dn_type == DMU_OT_NONE || dn->dn_free_txg != 0) { in dnode_hold_impl()
1619 mutex_exit(&dn->dn_mtx); in dnode_hold_impl()
1627 mutex_exit(&dn->dn_mtx); in dnode_hold_impl()
1680 dn = dnh->dnh_dnode; in dnode_hold_impl()
1682 dn = dnode_create(os, dn_block + idx, db, in dnode_hold_impl()
1687 mutex_enter(&dn->dn_mtx); in dnode_hold_impl()
1688 if (!zfs_refcount_is_zero(&dn->dn_holds) || dn->dn_free_txg) { in dnode_hold_impl()
1690 mutex_exit(&dn->dn_mtx); in dnode_hold_impl()
1698 mutex_exit(&dn->dn_mtx); in dnode_hold_impl()
1711 ASSERT0(dn->dn_free_txg); in dnode_hold_impl()
1713 if (zfs_refcount_add(&dn->dn_holds, tag) == 1) in dnode_hold_impl()
1716 mutex_exit(&dn->dn_mtx); in dnode_hold_impl()
1721 DNODE_VERIFY(dn); in dnode_hold_impl()
1723 ASSERT3P(dn->dn_dbuf, ==, db); in dnode_hold_impl()
1724 ASSERT3U(dn->dn_object, ==, object); in dnode_hold_impl()
1727 *dnp = dn; in dnode_hold_impl()
1747 dnode_add_ref(dnode_t *dn, const void *tag) in dnode_add_ref() argument
1749 mutex_enter(&dn->dn_mtx); in dnode_add_ref()
1750 if (zfs_refcount_is_zero(&dn->dn_holds)) { in dnode_add_ref()
1751 mutex_exit(&dn->dn_mtx); in dnode_add_ref()
1754 VERIFY(1 < zfs_refcount_add(&dn->dn_holds, tag)); in dnode_add_ref()
1755 mutex_exit(&dn->dn_mtx); in dnode_add_ref()
1760 dnode_rele(dnode_t *dn, const void *tag) in dnode_rele() argument
1762 mutex_enter(&dn->dn_mtx); in dnode_rele()
1763 dnode_rele_and_unlock(dn, tag, B_FALSE); in dnode_rele()
1767 dnode_rele_and_unlock(dnode_t *dn, const void *tag, boolean_t evicting) in dnode_rele_and_unlock() argument
1771 dmu_buf_impl_t *db = dn->dn_dbuf; in dnode_rele_and_unlock()
1772 dnode_handle_t *dnh = dn->dn_handle; in dnode_rele_and_unlock()
1774 refs = zfs_refcount_remove(&dn->dn_holds, tag); in dnode_rele_and_unlock()
1776 cv_broadcast(&dn->dn_nodnholds); in dnode_rele_and_unlock()
1777 mutex_exit(&dn->dn_mtx); in dnode_rele_and_unlock()
1829 dnode_is_dirty(dnode_t *dn) in dnode_is_dirty() argument
1831 mutex_enter(&dn->dn_mtx); in dnode_is_dirty()
1834 if (multilist_link_active(&dn->dn_dirty_link[i]) || in dnode_is_dirty()
1835 !list_is_empty(&dn->dn_dirty_records[i])) { in dnode_is_dirty()
1836 mutex_exit(&dn->dn_mtx); in dnode_is_dirty()
1841 mutex_exit(&dn->dn_mtx); in dnode_is_dirty()
1847 dnode_setdirty(dnode_t *dn, dmu_tx_t *tx) in dnode_setdirty() argument
1849 objset_t *os = dn->dn_objset; in dnode_setdirty()
1852 if (DMU_OBJECT_IS_SPECIAL(dn->dn_object)) { in dnode_setdirty()
1857 DNODE_VERIFY(dn); in dnode_setdirty()
1860 mutex_enter(&dn->dn_mtx); in dnode_setdirty()
1861 ASSERT(dn->dn_phys->dn_type || dn->dn_allocated_txg); in dnode_setdirty()
1862 ASSERT(dn->dn_free_txg == 0 || dn->dn_free_txg >= txg); in dnode_setdirty()
1863 mutex_exit(&dn->dn_mtx); in dnode_setdirty()
1869 dmu_objset_userquota_get_ids(dn, B_TRUE, tx); in dnode_setdirty()
1872 multilist_sublist_t *mls = multilist_sublist_lock_obj(dirtylist, dn); in dnode_setdirty()
1877 if (multilist_link_active(&dn->dn_dirty_link[txg & TXG_MASK])) { in dnode_setdirty()
1882 ASSERT(!zfs_refcount_is_zero(&dn->dn_holds) || in dnode_setdirty()
1883 !avl_is_empty(&dn->dn_dbufs)); in dnode_setdirty()
1884 ASSERT(dn->dn_datablksz != 0); in dnode_setdirty()
1885 ASSERT0(dn->dn_next_bonuslen[txg & TXG_MASK]); in dnode_setdirty()
1886 ASSERT0(dn->dn_next_blksz[txg & TXG_MASK]); in dnode_setdirty()
1887 ASSERT0(dn->dn_next_bonustype[txg & TXG_MASK]); in dnode_setdirty()
1890 (u_longlong_t)dn->dn_object, (u_longlong_t)txg); in dnode_setdirty()
1892 multilist_sublist_insert_head(mls, dn); in dnode_setdirty()
1905 VERIFY(dnode_add_ref(dn, (void *)(uintptr_t)tx->tx_txg)); in dnode_setdirty()
1907 (void) dbuf_dirty(dn->dn_dbuf, tx); in dnode_setdirty()
1913 dnode_free(dnode_t *dn, dmu_tx_t *tx) in dnode_free() argument
1915 mutex_enter(&dn->dn_mtx); in dnode_free()
1916 if (dn->dn_type == DMU_OT_NONE || dn->dn_free_txg) { in dnode_free()
1917 mutex_exit(&dn->dn_mtx); in dnode_free()
1920 dn->dn_free_txg = tx->tx_txg; in dnode_free()
1921 mutex_exit(&dn->dn_mtx); in dnode_free()
1923 dnode_setdirty(dn, tx); in dnode_free()
1931 dnode_set_blksz(dnode_t *dn, uint64_t size, int ibs, dmu_tx_t *tx) in dnode_set_blksz() argument
1936 ASSERT3U(size, <=, spa_maxblocksize(dmu_objset_spa(dn->dn_objset))); in dnode_set_blksz()
1942 if (ibs == dn->dn_indblkshift) in dnode_set_blksz()
1945 if (size == dn->dn_datablksz && ibs == 0) in dnode_set_blksz()
1948 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_set_blksz()
1951 if (dn->dn_maxblkid != 0) in dnode_set_blksz()
1954 mutex_enter(&dn->dn_dbufs_mtx); in dnode_set_blksz()
1955 for (db = avl_first(&dn->dn_dbufs); db != NULL; in dnode_set_blksz()
1956 db = AVL_NEXT(&dn->dn_dbufs, db)) { in dnode_set_blksz()
1959 mutex_exit(&dn->dn_dbufs_mtx); in dnode_set_blksz()
1963 mutex_exit(&dn->dn_dbufs_mtx); in dnode_set_blksz()
1965 if (ibs && dn->dn_nlevels != 1) in dnode_set_blksz()
1968 dnode_setdirty(dn, tx); in dnode_set_blksz()
1969 if (size != dn->dn_datablksz) { in dnode_set_blksz()
1971 err = dbuf_hold_impl(dn, 0, 0, TRUE, FALSE, FTAG, &db); in dnode_set_blksz()
1978 dnode_setdblksz(dn, size); in dnode_set_blksz()
1979 dn->dn_next_blksz[tx->tx_txg & TXG_MASK] = size; in dnode_set_blksz()
1984 dn->dn_indblkshift = ibs; in dnode_set_blksz()
1985 dn->dn_next_indblkshift[tx->tx_txg & TXG_MASK] = ibs; in dnode_set_blksz()
1988 rw_exit(&dn->dn_struct_rwlock); in dnode_set_blksz()
1992 rw_exit(&dn->dn_struct_rwlock); in dnode_set_blksz()
1997 dnode_set_nlevels_impl(dnode_t *dn, int new_nlevels, dmu_tx_t *tx) in dnode_set_nlevels_impl() argument
2000 int old_nlevels = dn->dn_nlevels; in dnode_set_nlevels_impl()
2005 ASSERT(RW_WRITE_HELD(&dn->dn_struct_rwlock)); in dnode_set_nlevels_impl()
2007 ASSERT3U(new_nlevels, >, dn->dn_nlevels); in dnode_set_nlevels_impl()
2008 dn->dn_nlevels = new_nlevels; in dnode_set_nlevels_impl()
2010 ASSERT3U(new_nlevels, >, dn->dn_next_nlevels[txgoff]); in dnode_set_nlevels_impl()
2011 dn->dn_next_nlevels[txgoff] = new_nlevels; in dnode_set_nlevels_impl()
2014 db = dbuf_hold_level(dn, old_nlevels, 0, FTAG); in dnode_set_nlevels_impl()
2020 mutex_enter(&dn->dn_mtx); in dnode_set_nlevels_impl()
2022 list = &dn->dn_dirty_records[txgoff]; in dnode_set_nlevels_impl()
2024 dr_next = list_next(&dn->dn_dirty_records[txgoff], dr); in dnode_set_nlevels_impl()
2031 list_remove(&dn->dn_dirty_records[txgoff], dr); in dnode_set_nlevels_impl()
2037 mutex_exit(&dn->dn_mtx); in dnode_set_nlevels_impl()
2041 dnode_set_nlevels(dnode_t *dn, int nlevels, dmu_tx_t *tx) in dnode_set_nlevels() argument
2045 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_set_nlevels()
2047 if (dn->dn_nlevels == nlevels) { in dnode_set_nlevels()
2050 } else if (nlevels < dn->dn_nlevels) { in dnode_set_nlevels()
2055 dnode_set_nlevels_impl(dn, nlevels, tx); in dnode_set_nlevels()
2058 rw_exit(&dn->dn_struct_rwlock); in dnode_set_nlevels()
2064 dnode_new_blkid(dnode_t *dn, uint64_t blkid, dmu_tx_t *tx, boolean_t have_read, in dnode_new_blkid() argument
2073 RW_READ_HELD(&dn->dn_struct_rwlock) : in dnode_new_blkid()
2074 RW_WRITE_HELD(&dn->dn_struct_rwlock)); in dnode_new_blkid()
2081 if (blkid <= dn->dn_maxblkid) in dnode_new_blkid()
2084 if (!rw_tryupgrade(&dn->dn_struct_rwlock)) { in dnode_new_blkid()
2085 rw_exit(&dn->dn_struct_rwlock); in dnode_new_blkid()
2086 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_new_blkid()
2094 if (!force && blkid <= dn->dn_maxblkid) in dnode_new_blkid()
2102 dn->dn_maxblkid = blkid; in dnode_new_blkid()
2103 dn->dn_next_maxblkid[tx->tx_txg & TXG_MASK] = in dnode_new_blkid()
2111 epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; in dnode_new_blkid()
2112 for (sz = dn->dn_nblkptr; in dnode_new_blkid()
2113 sz <= blkid && sz >= dn->dn_nblkptr; sz <<= epbs) in dnode_new_blkid()
2119 if (new_nlevels > dn->dn_nlevels) in dnode_new_blkid()
2120 dnode_set_nlevels_impl(dn, new_nlevels, tx); in dnode_new_blkid()
2122 ASSERT3U(dn->dn_nlevels, >=, new_nlevels); in dnode_new_blkid()
2127 rw_downgrade(&dn->dn_struct_rwlock); in dnode_new_blkid()
2131 dnode_dirty_l1(dnode_t *dn, uint64_t l1blkid, dmu_tx_t *tx) in dnode_dirty_l1() argument
2133 dmu_buf_impl_t *db = dbuf_hold_level(dn, 1, l1blkid, FTAG); in dnode_dirty_l1()
2145 dnode_dirty_l1range(dnode_t *dn, uint64_t start_blkid, uint64_t end_blkid, in dnode_dirty_l1range() argument
2154 mutex_enter(&dn->dn_dbufs_mtx); in dnode_dirty_l1range()
2161 db = avl_find(&dn->dn_dbufs, db_search, &where); in dnode_dirty_l1range()
2163 db = avl_nearest(&dn->dn_dbufs, where, AVL_AFTER); in dnode_dirty_l1range()
2184 mutex_exit(&dn->dn_dbufs_mtx); in dnode_dirty_l1range()
2185 dnode_dirty_l1(dn, db->db_blkid, tx); in dnode_dirty_l1range()
2186 mutex_enter(&dn->dn_dbufs_mtx); in dnode_dirty_l1range()
2196 db = avl_find(&dn->dn_dbufs, db_search, &where); in dnode_dirty_l1range()
2198 db = avl_nearest(&dn->dn_dbufs, where, AVL_AFTER); in dnode_dirty_l1range()
2199 for (; db != NULL; db = AVL_NEXT(&dn->dn_dbufs, db)) { in dnode_dirty_l1range()
2207 mutex_exit(&dn->dn_dbufs_mtx); in dnode_dirty_l1range()
2211 dnode_set_dirtyctx(dnode_t *dn, dmu_tx_t *tx, const void *tag) in dnode_set_dirtyctx() argument
2217 if (dn->dn_dirtyctx == DN_UNDIRTIED) { in dnode_set_dirtyctx()
2218 dsl_dataset_t *ds = dn->dn_objset->os_dsl_dataset; in dnode_set_dirtyctx()
2223 if (!BP_IS_HOLE(dn->dn_objset->os_rootbp)) { in dnode_set_dirtyctx()
2225 dn->dn_dirtyctx = DN_DIRTY_SYNC; in dnode_set_dirtyctx()
2227 dn->dn_dirtyctx = DN_DIRTY_OPEN; in dnode_set_dirtyctx()
2228 dn->dn_dirtyctx_firstset = tag; in dnode_set_dirtyctx()
2237 dnode_partial_zero(dnode_t *dn, uint64_t off, uint64_t blkoff, uint64_t len, in dnode_partial_zero() argument
2243 rw_enter(&dn->dn_struct_rwlock, RW_READER); in dnode_partial_zero()
2244 res = dbuf_hold_impl(dn, 0, dbuf_whichblock(dn, 0, off), TRUE, FALSE, in dnode_partial_zero()
2246 rw_exit(&dn->dn_struct_rwlock); in dnode_partial_zero()
2268 dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx) in dnode_free_range() argument
2275 blksz = dn->dn_datablksz; in dnode_free_range()
2276 blkshift = dn->dn_datablkshift; in dnode_free_range()
2277 epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; in dnode_free_range()
2290 if ((off >> blkshift) > dn->dn_maxblkid) in dnode_free_range()
2293 ASSERT(dn->dn_maxblkid == 0); in dnode_free_range()
2300 if (dn->dn_nlevels > 1) { in dnode_free_range()
2301 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_free_range()
2302 dnode_dirty_l1(dn, 0, tx); in dnode_free_range()
2303 rw_exit(&dn->dn_struct_rwlock); in dnode_free_range()
2321 dnode_partial_zero(dn, off, blkoff, head, tx); in dnode_free_range()
2331 if ((off >> blkshift) > dn->dn_maxblkid) in dnode_free_range()
2345 dnode_partial_zero(dn, off + len, 0, tail, tx); in dnode_free_range()
2380 if (dn->dn_nlevels > 1) { in dnode_free_range()
2381 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_free_range()
2385 dnode_dirty_l1(dn, first, tx); in dnode_free_range()
2387 last = dn->dn_maxblkid >> epbs; in dnode_free_range()
2391 dnode_dirty_l1(dn, last, tx); in dnode_free_range()
2393 dnode_dirty_l1range(dn, first, last, tx); in dnode_free_range()
2395 int shift = dn->dn_datablkshift + dn->dn_indblkshift - in dnode_free_range()
2405 int err = dnode_next_offset(dn, DNODE_FIND_HAVELOCK, in dnode_free_range()
2424 dnode_dirty_l1(dn, i, tx); in dnode_free_range()
2426 rw_exit(&dn->dn_struct_rwlock); in dnode_free_range()
2434 mutex_enter(&dn->dn_mtx); in dnode_free_range()
2437 if (dn->dn_free_ranges[txgoff] == NULL) { in dnode_free_range()
2438 dn->dn_free_ranges[txgoff] = zfs_range_tree_create(NULL, in dnode_free_range()
2441 zfs_range_tree_clear(dn->dn_free_ranges[txgoff], blkid, nblks); in dnode_free_range()
2442 zfs_range_tree_add(dn->dn_free_ranges[txgoff], blkid, nblks); in dnode_free_range()
2444 dprintf_dnode(dn, "blkid=%llu nblks=%llu txg=%llu\n", in dnode_free_range()
2447 mutex_exit(&dn->dn_mtx); in dnode_free_range()
2449 dbuf_free_range(dn, blkid, blkid + nblks - 1, tx); in dnode_free_range()
2450 dnode_setdirty(dn, tx); in dnode_free_range()
2454 dnode_spill_freed(dnode_t *dn) in dnode_spill_freed() argument
2458 mutex_enter(&dn->dn_mtx); in dnode_spill_freed()
2460 if (dn->dn_rm_spillblk[i] == DN_KILL_SPILLBLK) in dnode_spill_freed()
2463 mutex_exit(&dn->dn_mtx); in dnode_spill_freed()
2469 dnode_block_freed(dnode_t *dn, uint64_t blkid) in dnode_block_freed() argument
2476 if (dn->dn_free_txg) in dnode_block_freed()
2480 return (dnode_spill_freed(dn)); in dnode_block_freed()
2482 mutex_enter(&dn->dn_mtx); in dnode_block_freed()
2484 if (dn->dn_free_ranges[i] != NULL && in dnode_block_freed()
2485 zfs_range_tree_contains(dn->dn_free_ranges[i], blkid, 1)) in dnode_block_freed()
2488 mutex_exit(&dn->dn_mtx); in dnode_block_freed()
2494 dnode_diduse_space(dnode_t *dn, int64_t delta) in dnode_diduse_space() argument
2497 dprintf_dnode(dn, "dn=%p dnp=%p used=%llu delta=%lld\n", in dnode_diduse_space()
2498 dn, dn->dn_phys, in dnode_diduse_space()
2499 (u_longlong_t)dn->dn_phys->dn_used, in dnode_diduse_space()
2502 mutex_enter(&dn->dn_mtx); in dnode_diduse_space()
2503 space = DN_USED_BYTES(dn->dn_phys); in dnode_diduse_space()
2510 if (spa_version(dn->dn_objset->os_spa) < SPA_VERSION_DNODE_BYTES) { in dnode_diduse_space()
2511 ASSERT((dn->dn_phys->dn_flags & DNODE_FLAG_USED_BYTES) == 0); in dnode_diduse_space()
2513 dn->dn_phys->dn_used = space >> DEV_BSHIFT; in dnode_diduse_space()
2515 dn->dn_phys->dn_used = space; in dnode_diduse_space()
2516 dn->dn_phys->dn_flags |= DNODE_FLAG_USED_BYTES; in dnode_diduse_space()
2518 mutex_exit(&dn->dn_mtx); in dnode_diduse_space()
2540 dnode_next_offset_level(dnode_t *dn, int flags, uint64_t *offset, in dnode_next_offset_level() argument
2545 uint64_t epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT; in dnode_next_offset_level()
2551 ASSERT(RW_LOCK_HELD(&dn->dn_struct_rwlock)); in dnode_next_offset_level()
2557 if (lvl == dn->dn_phys->dn_nlevels) { in dnode_next_offset_level()
2559 epb = dn->dn_phys->dn_nblkptr; in dnode_next_offset_level()
2560 data = dn->dn_phys->dn_blkptr; in dnode_next_offset_level()
2562 uint64_t blkid = dbuf_whichblock(dn, lvl, *offset); in dnode_next_offset_level()
2563 error = dbuf_hold_impl(dn, lvl, blkid, TRUE, FALSE, FTAG, &db); in dnode_next_offset_level()
2600 ASSERT(dn->dn_type == DMU_OT_DNODE); in dnode_next_offset_level()
2617 span = (lvl - 1) * epbs + dn->dn_datablkshift; in dnode_next_offset_level()
2628 ASSERT3U((lvl - 1), ==, dn->dn_phys->dn_nlevels - 1); in dnode_next_offset_level()
2679 * dnode_next_offset(dn, flags, offset, 1, 1, 0);
2694 dnode_next_offset(dnode_t *dn, int flags, uint64_t *offset, in dnode_next_offset() argument
2702 rw_enter(&dn->dn_struct_rwlock, RW_READER); in dnode_next_offset()
2704 if (dn->dn_phys->dn_nlevels == 0) { in dnode_next_offset()
2709 if (dn->dn_datablkshift == 0) { in dnode_next_offset()
2710 if (*offset < dn->dn_datablksz) { in dnode_next_offset()
2712 *offset = dn->dn_datablksz; in dnode_next_offset()
2719 maxlvl = dn->dn_phys->dn_nlevels; in dnode_next_offset()
2722 error = dnode_next_offset_level(dn, in dnode_next_offset()
2729 error = dnode_next_offset_level(dn, in dnode_next_offset()
2747 rw_exit(&dn->dn_struct_rwlock); in dnode_next_offset()