Lines Matching full:dn

126 	dnode_t *dn = arg;  in dnode_cons()  local
128 rw_init(&dn->dn_struct_rwlock, NULL, RW_NOLOCKDEP, NULL); in dnode_cons()
129 mutex_init(&dn->dn_mtx, NULL, MUTEX_DEFAULT, NULL); in dnode_cons()
130 mutex_init(&dn->dn_dbufs_mtx, NULL, MUTEX_DEFAULT, NULL); in dnode_cons()
131 cv_init(&dn->dn_notxholds, NULL, CV_DEFAULT, NULL); in dnode_cons()
132 cv_init(&dn->dn_nodnholds, NULL, CV_DEFAULT, NULL); in dnode_cons()
138 zfs_refcount_create_untracked(&dn->dn_holds); in dnode_cons()
139 zfs_refcount_create(&dn->dn_tx_holds); in dnode_cons()
140 list_link_init(&dn->dn_link); in dnode_cons()
142 memset(dn->dn_next_type, 0, sizeof (dn->dn_next_type)); in dnode_cons()
143 memset(dn->dn_next_nblkptr, 0, sizeof (dn->dn_next_nblkptr)); in dnode_cons()
144 memset(dn->dn_next_nlevels, 0, sizeof (dn->dn_next_nlevels)); in dnode_cons()
145 memset(dn->dn_next_indblkshift, 0, sizeof (dn->dn_next_indblkshift)); in dnode_cons()
146 memset(dn->dn_next_bonustype, 0, sizeof (dn->dn_next_bonustype)); in dnode_cons()
147 memset(dn->dn_rm_spillblk, 0, sizeof (dn->dn_rm_spillblk)); in dnode_cons()
148 memset(dn->dn_next_bonuslen, 0, sizeof (dn->dn_next_bonuslen)); in dnode_cons()
149 memset(dn->dn_next_blksz, 0, sizeof (dn->dn_next_blksz)); in dnode_cons()
150 memset(dn->dn_next_maxblkid, 0, sizeof (dn->dn_next_maxblkid)); in dnode_cons()
153 multilist_link_init(&dn->dn_dirty_link[i]); in dnode_cons()
154 dn->dn_free_ranges[i] = NULL; in dnode_cons()
155 list_create(&dn->dn_dirty_records[i], in dnode_cons()
160 dn->dn_allocated_txg = 0; in dnode_cons()
161 dn->dn_free_txg = 0; in dnode_cons()
162 dn->dn_assigned_txg = 0; in dnode_cons()
163 dn->dn_dirty_txg = 0; in dnode_cons()
164 dn->dn_dirtyctx = 0; in dnode_cons()
165 dn->dn_dirtyctx_firstset = NULL; in dnode_cons()
166 dn->dn_bonus = NULL; in dnode_cons()
167 dn->dn_have_spill = B_FALSE; in dnode_cons()
168 dn->dn_zio = NULL; in dnode_cons()
169 dn->dn_oldused = 0; in dnode_cons()
170 dn->dn_oldflags = 0; in dnode_cons()
171 dn->dn_olduid = 0; in dnode_cons()
172 dn->dn_oldgid = 0; in dnode_cons()
173 dn->dn_oldprojid = ZFS_DEFAULT_PROJID; in dnode_cons()
174 dn->dn_newuid = 0; in dnode_cons()
175 dn->dn_newgid = 0; in dnode_cons()
176 dn->dn_newprojid = ZFS_DEFAULT_PROJID; in dnode_cons()
177 dn->dn_id_flags = 0; in dnode_cons()
179 dn->dn_dbufs_count = 0; in dnode_cons()
180 avl_create(&dn->dn_dbufs, dbuf_compare, sizeof (dmu_buf_impl_t), in dnode_cons()
183 dn->dn_moved = 0; in dnode_cons()
191 dnode_t *dn = arg; in dnode_dest() local
193 rw_destroy(&dn->dn_struct_rwlock); in dnode_dest()
194 mutex_destroy(&dn->dn_mtx); in dnode_dest()
195 mutex_destroy(&dn->dn_dbufs_mtx); in dnode_dest()
196 cv_destroy(&dn->dn_notxholds); in dnode_dest()
197 cv_destroy(&dn->dn_nodnholds); in dnode_dest()
198 zfs_refcount_destroy(&dn->dn_holds); in dnode_dest()
199 zfs_refcount_destroy(&dn->dn_tx_holds); in dnode_dest()
200 ASSERT(!list_link_active(&dn->dn_link)); in dnode_dest()
203 ASSERT(!multilist_link_active(&dn->dn_dirty_link[i])); in dnode_dest()
204 ASSERT3P(dn->dn_free_ranges[i], ==, NULL); in dnode_dest()
205 list_destroy(&dn->dn_dirty_records[i]); in dnode_dest()
206 ASSERT0(dn->dn_next_nblkptr[i]); in dnode_dest()
207 ASSERT0(dn->dn_next_nlevels[i]); in dnode_dest()
208 ASSERT0(dn->dn_next_indblkshift[i]); in dnode_dest()
209 ASSERT0(dn->dn_next_bonustype[i]); in dnode_dest()
210 ASSERT0(dn->dn_rm_spillblk[i]); in dnode_dest()
211 ASSERT0(dn->dn_next_bonuslen[i]); in dnode_dest()
212 ASSERT0(dn->dn_next_blksz[i]); in dnode_dest()
213 ASSERT0(dn->dn_next_maxblkid[i]); in dnode_dest()
216 ASSERT0(dn->dn_allocated_txg); in dnode_dest()
217 ASSERT0(dn->dn_free_txg); in dnode_dest()
218 ASSERT0(dn->dn_assigned_txg); in dnode_dest()
219 ASSERT0(dn->dn_dirty_txg); in dnode_dest()
220 ASSERT0(dn->dn_dirtyctx); in dnode_dest()
221 ASSERT3P(dn->dn_dirtyctx_firstset, ==, NULL); in dnode_dest()
222 ASSERT3P(dn->dn_bonus, ==, NULL); in dnode_dest()
223 ASSERT(!dn->dn_have_spill); in dnode_dest()
224 ASSERT3P(dn->dn_zio, ==, NULL); in dnode_dest()
225 ASSERT0(dn->dn_oldused); in dnode_dest()
226 ASSERT0(dn->dn_oldflags); in dnode_dest()
227 ASSERT0(dn->dn_olduid); in dnode_dest()
228 ASSERT0(dn->dn_oldgid); in dnode_dest()
229 ASSERT0(dn->dn_oldprojid); in dnode_dest()
230 ASSERT0(dn->dn_newuid); in dnode_dest()
231 ASSERT0(dn->dn_newgid); in dnode_dest()
232 ASSERT0(dn->dn_newprojid); in dnode_dest()
233 ASSERT0(dn->dn_id_flags); in dnode_dest()
235 ASSERT0(dn->dn_dbufs_count); in dnode_dest()
236 avl_destroy(&dn->dn_dbufs); in dnode_dest()
396 dnode_verify(dnode_t *dn) in dnode_verify() argument
400 ASSERT(dn->dn_phys); in dnode_verify()
401 ASSERT(dn->dn_objset); in dnode_verify()
402 ASSERT(dn->dn_handle->dnh_dnode == dn); in dnode_verify()
404 ASSERT(DMU_OT_IS_VALID(dn->dn_phys->dn_type)); in dnode_verify()
409 if (!RW_WRITE_HELD(&dn->dn_struct_rwlock)) { in dnode_verify()
410 rw_enter(&dn->dn_struct_rwlock, RW_READER); in dnode_verify()
413 if (dn->dn_phys->dn_type != DMU_OT_NONE || dn->dn_allocated_txg != 0) { in dnode_verify()
415 int max_bonuslen = DN_SLOTS_TO_BONUSLEN(dn->dn_num_slots); in dnode_verify()
416 ASSERT3U(dn->dn_indblkshift, <=, SPA_MAXBLOCKSHIFT); in dnode_verify()
417 if (dn->dn_datablkshift) { in dnode_verify()
418 ASSERT3U(dn->dn_datablkshift, >=, SPA_MINBLOCKSHIFT); in dnode_verify()
419 ASSERT3U(dn->dn_datablkshift, <=, SPA_MAXBLOCKSHIFT); in dnode_verify()
420 ASSERT3U(1<<dn->dn_datablkshift, ==, dn->dn_datablksz); in dnode_verify()
422 ASSERT3U(dn->dn_nlevels, <=, 30); in dnode_verify()
423 ASSERT(DMU_OT_IS_VALID(dn->dn_type)); in dnode_verify()
424 ASSERT3U(dn->dn_nblkptr, >=, 1); in dnode_verify()
425 ASSERT3U(dn->dn_nblkptr, <=, DN_MAX_NBLKPTR); in dnode_verify()
426 ASSERT3U(dn->dn_bonuslen, <=, max_bonuslen); in dnode_verify()
427 ASSERT3U(dn->dn_datablksz, ==, in dnode_verify()
428 dn->dn_datablkszsec << SPA_MINBLOCKSHIFT); in dnode_verify()
429 ASSERT3U(ISP2(dn->dn_datablksz), ==, dn->dn_datablkshift != 0); in dnode_verify()
430 ASSERT3U((dn->dn_nblkptr - 1) * sizeof (blkptr_t) + in dnode_verify()
431 dn->dn_bonuslen, <=, max_bonuslen); in dnode_verify()
433 ASSERT3U(dn->dn_next_nlevels[i], <=, dn->dn_nlevels); in dnode_verify()
436 if (dn->dn_phys->dn_type != DMU_OT_NONE) in dnode_verify()
437 ASSERT3U(dn->dn_phys->dn_nlevels, <=, dn->dn_nlevels); in dnode_verify()
438 ASSERT(DMU_OBJECT_IS_SPECIAL(dn->dn_object) || dn->dn_dbuf != NULL); in dnode_verify()
439 if (dn->dn_dbuf != NULL) { in dnode_verify()
440 ASSERT3P(dn->dn_phys, ==, in dnode_verify()
441 (dnode_phys_t *)dn->dn_dbuf->db.db_data + in dnode_verify()
442 (dn->dn_object % (dn->dn_dbuf->db.db_size >> DNODE_SHIFT))); in dnode_verify()
445 rw_exit(&dn->dn_struct_rwlock); in dnode_verify()
512 dnode_setbonuslen(dnode_t *dn, int newsize, dmu_tx_t *tx) in dnode_setbonuslen() argument
514 ASSERT3U(zfs_refcount_count(&dn->dn_holds), >=, 1); in dnode_setbonuslen()
516 dnode_setdirty(dn, tx); in dnode_setbonuslen()
517 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_setbonuslen()
518 ASSERT3U(newsize, <=, DN_SLOTS_TO_BONUSLEN(dn->dn_num_slots) - in dnode_setbonuslen()
519 (dn->dn_nblkptr-1) * sizeof (blkptr_t)); in dnode_setbonuslen()
521 if (newsize < dn->dn_bonuslen) { in dnode_setbonuslen()
523 size_t diff = dn->dn_bonuslen - newsize; in dnode_setbonuslen()
524 char *data_end = ((char *)dn->dn_bonus->db.db_data) + newsize; in dnode_setbonuslen()
528 dn->dn_bonuslen = newsize; in dnode_setbonuslen()
530 dn->dn_next_bonuslen[tx->tx_txg & TXG_MASK] = DN_ZERO_BONUSLEN; in dnode_setbonuslen()
532 dn->dn_next_bonuslen[tx->tx_txg & TXG_MASK] = dn->dn_bonuslen; in dnode_setbonuslen()
533 rw_exit(&dn->dn_struct_rwlock); in dnode_setbonuslen()
537 dnode_setbonus_type(dnode_t *dn, dmu_object_type_t newtype, dmu_tx_t *tx) in dnode_setbonus_type() argument
539 ASSERT3U(zfs_refcount_count(&dn->dn_holds), >=, 1); in dnode_setbonus_type()
540 dnode_setdirty(dn, tx); in dnode_setbonus_type()
541 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_setbonus_type()
542 dn->dn_bonustype = newtype; in dnode_setbonus_type()
543 dn->dn_next_bonustype[tx->tx_txg & TXG_MASK] = dn->dn_bonustype; in dnode_setbonus_type()
544 rw_exit(&dn->dn_struct_rwlock); in dnode_setbonus_type()
548 dnode_set_storage_type(dnode_t *dn, dmu_object_type_t newtype) in dnode_set_storage_type() argument
554 ASSERT3U(zfs_refcount_count(&dn->dn_holds), >=, 1); in dnode_set_storage_type()
555 dn->dn_storage_type = newtype; in dnode_set_storage_type()
559 dnode_rm_spill(dnode_t *dn, dmu_tx_t *tx) in dnode_rm_spill() argument
561 ASSERT3U(zfs_refcount_count(&dn->dn_holds), >=, 1); in dnode_rm_spill()
562 ASSERT(RW_WRITE_HELD(&dn->dn_struct_rwlock)); in dnode_rm_spill()
563 dnode_setdirty(dn, tx); in dnode_rm_spill()
564 dn->dn_rm_spillblk[tx->tx_txg & TXG_MASK] = DN_KILL_SPILLBLK; in dnode_rm_spill()
565 dn->dn_have_spill = B_FALSE; in dnode_rm_spill()
569 dnode_setdblksz(dnode_t *dn, int size) in dnode_setdblksz() argument
575 1<<(sizeof (dn->dn_phys->dn_datablkszsec) * 8)); in dnode_setdblksz()
576 dn->dn_datablksz = size; in dnode_setdblksz()
577 dn->dn_datablkszsec = size >> SPA_MINBLOCKSHIFT; in dnode_setdblksz()
578 dn->dn_datablkshift = ISP2(size) ? highbit64(size - 1) : 0; in dnode_setdblksz()
585 dnode_t *dn; in dnode_create() local
587 dn = kmem_cache_alloc(dnode_cache, KM_SLEEP); in dnode_create()
588 dn->dn_moved = 0; in dnode_create()
594 dn->dn_object = object; in dnode_create()
595 dn->dn_dbuf = db; in dnode_create()
596 dn->dn_handle = dnh; in dnode_create()
597 dn->dn_phys = dnp; in dnode_create()
600 dnode_setdblksz(dn, dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT); in dnode_create()
602 dn->dn_datablksz = 0; in dnode_create()
603 dn->dn_datablkszsec = 0; in dnode_create()
604 dn->dn_datablkshift = 0; in dnode_create()
606 dn->dn_indblkshift = dnp->dn_indblkshift; in dnode_create()
607 dn->dn_nlevels = dnp->dn_nlevels; in dnode_create()
608 dn->dn_type = dnp->dn_type; in dnode_create()
609 dn->dn_nblkptr = dnp->dn_nblkptr; in dnode_create()
610 dn->dn_checksum = dnp->dn_checksum; in dnode_create()
611 dn->dn_compress = dnp->dn_compress; in dnode_create()
612 dn->dn_bonustype = dnp->dn_bonustype; in dnode_create()
613 dn->dn_bonuslen = dnp->dn_bonuslen; in dnode_create()
614 dn->dn_num_slots = dnp->dn_extra_slots + 1; in dnode_create()
615 dn->dn_maxblkid = dnp->dn_maxblkid; in dnode_create()
616 dn->dn_have_spill = ((dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) != 0); in dnode_create()
617 dn->dn_id_flags = 0; in dnode_create()
619 dn->dn_storage_type = DMU_OT_NONE; in dnode_create()
621 dmu_zfetch_init(&dn->dn_zfetch, dn); in dnode_create()
623 ASSERT(DMU_OT_IS_VALID(dn->dn_phys->dn_type)); in dnode_create()
637 list_insert_head(&os->os_dnodes, dn); in dnode_create()
644 dn->dn_objset = os; in dnode_create()
646 dnh->dnh_dnode = dn; in dnode_create()
651 return (dn); in dnode_create()
658 dnode_destroy(dnode_t *dn) in dnode_destroy() argument
660 objset_t *os = dn->dn_objset; in dnode_destroy()
663 ASSERT((dn->dn_id_flags & DN_ID_NEW_EXIST) == 0); in dnode_destroy()
666 POINTER_INVALIDATE(&dn->dn_objset); in dnode_destroy()
667 if (!DMU_OBJECT_IS_SPECIAL(dn->dn_object)) { in dnode_destroy()
668 list_remove(&os->os_dnodes, dn); in dnode_destroy()
676 if (!zrl_is_locked(&dn->dn_handle->dnh_zrlock)) in dnode_destroy()
677 zrl_remove(&dn->dn_handle->dnh_zrlock); in dnode_destroy()
679 dn->dn_allocated_txg = 0; in dnode_destroy()
680 dn->dn_free_txg = 0; in dnode_destroy()
681 dn->dn_assigned_txg = 0; in dnode_destroy()
682 dn->dn_dirty_txg = 0; in dnode_destroy()
684 dn->dn_dirtyctx = 0; in dnode_destroy()
685 dn->dn_dirtyctx_firstset = NULL; in dnode_destroy()
686 if (dn->dn_bonus != NULL) { in dnode_destroy()
687 mutex_enter(&dn->dn_bonus->db_mtx); in dnode_destroy()
688 dbuf_destroy(dn->dn_bonus); in dnode_destroy()
689 dn->dn_bonus = NULL; in dnode_destroy()
691 dn->dn_zio = NULL; in dnode_destroy()
693 dn->dn_have_spill = B_FALSE; in dnode_destroy()
694 dn->dn_oldused = 0; in dnode_destroy()
695 dn->dn_oldflags = 0; in dnode_destroy()
696 dn->dn_olduid = 0; in dnode_destroy()
697 dn->dn_oldgid = 0; in dnode_destroy()
698 dn->dn_oldprojid = ZFS_DEFAULT_PROJID; in dnode_destroy()
699 dn->dn_newuid = 0; in dnode_destroy()
700 dn->dn_newgid = 0; in dnode_destroy()
701 dn->dn_newprojid = ZFS_DEFAULT_PROJID; in dnode_destroy()
702 dn->dn_id_flags = 0; in dnode_destroy()
704 dn->dn_storage_type = DMU_OT_NONE; in dnode_destroy()
706 dmu_zfetch_fini(&dn->dn_zfetch); in dnode_destroy()
707 kmem_cache_free(dnode_cache, dn); in dnode_destroy()
715 dnode_allocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, int ibs, in dnode_allocate() argument
722 spa_maxdnodesize(dmu_objset_spa(dn->dn_objset))); in dnode_allocate()
724 spa_maxblocksize(dmu_objset_spa(dn->dn_objset))); in dnode_allocate()
736 dn->dn_objset, (u_longlong_t)dn->dn_object, in dnode_allocate()
740 ASSERT(dn->dn_type == DMU_OT_NONE); in dnode_allocate()
741 ASSERT0(memcmp(dn->dn_phys, &dnode_phys_zero, sizeof (dnode_phys_t))); in dnode_allocate()
742 ASSERT(dn->dn_phys->dn_type == DMU_OT_NONE); in dnode_allocate()
751 ASSERT(dn->dn_type == DMU_OT_NONE); in dnode_allocate()
752 ASSERT0(dn->dn_maxblkid); in dnode_allocate()
753 ASSERT0(dn->dn_allocated_txg); in dnode_allocate()
754 ASSERT0(dn->dn_assigned_txg); in dnode_allocate()
755 ASSERT(zfs_refcount_is_zero(&dn->dn_tx_holds)); in dnode_allocate()
756 ASSERT3U(zfs_refcount_count(&dn->dn_holds), <=, 1); in dnode_allocate()
757 ASSERT(avl_is_empty(&dn->dn_dbufs)); in dnode_allocate()
760 ASSERT0(dn->dn_next_nblkptr[i]); in dnode_allocate()
761 ASSERT0(dn->dn_next_nlevels[i]); in dnode_allocate()
762 ASSERT0(dn->dn_next_indblkshift[i]); in dnode_allocate()
763 ASSERT0(dn->dn_next_bonuslen[i]); in dnode_allocate()
764 ASSERT0(dn->dn_next_bonustype[i]); in dnode_allocate()
765 ASSERT0(dn->dn_rm_spillblk[i]); in dnode_allocate()
766 ASSERT0(dn->dn_next_blksz[i]); in dnode_allocate()
767 ASSERT0(dn->dn_next_maxblkid[i]); in dnode_allocate()
768 ASSERT(!multilist_link_active(&dn->dn_dirty_link[i])); in dnode_allocate()
769 ASSERT3P(list_head(&dn->dn_dirty_records[i]), ==, NULL); in dnode_allocate()
770 ASSERT3P(dn->dn_free_ranges[i], ==, NULL); in dnode_allocate()
773 dn->dn_type = ot; in dnode_allocate()
774 dnode_setdblksz(dn, blocksize); in dnode_allocate()
775 dn->dn_indblkshift = ibs; in dnode_allocate()
776 dn->dn_nlevels = 1; in dnode_allocate()
777 dn->dn_num_slots = dn_slots; in dnode_allocate()
779 dn->dn_nblkptr = 1; in dnode_allocate()
781 dn->dn_nblkptr = MIN(DN_MAX_NBLKPTR, in dnode_allocate()
786 dn->dn_bonustype = bonustype; in dnode_allocate()
787 dn->dn_bonuslen = bonuslen; in dnode_allocate()
788 dn->dn_checksum = ZIO_CHECKSUM_INHERIT; in dnode_allocate()
789 dn->dn_compress = ZIO_COMPRESS_INHERIT; in dnode_allocate()
790 dn->dn_dirtyctx = 0; in dnode_allocate()
792 dn->dn_free_txg = 0; in dnode_allocate()
793 dn->dn_dirtyctx_firstset = NULL; in dnode_allocate()
794 dn->dn_dirty_txg = 0; in dnode_allocate()
796 dn->dn_allocated_txg = tx->tx_txg; in dnode_allocate()
797 dn->dn_id_flags = 0; in dnode_allocate()
799 dnode_setdirty(dn, tx); in dnode_allocate()
800 dn->dn_next_indblkshift[tx->tx_txg & TXG_MASK] = ibs; in dnode_allocate()
801 dn->dn_next_bonuslen[tx->tx_txg & TXG_MASK] = dn->dn_bonuslen; in dnode_allocate()
802 dn->dn_next_bonustype[tx->tx_txg & TXG_MASK] = dn->dn_bonustype; in dnode_allocate()
803 dn->dn_next_blksz[tx->tx_txg & TXG_MASK] = dn->dn_datablksz; in dnode_allocate()
807 dnode_reallocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, in dnode_reallocate() argument
815 spa_maxblocksize(dmu_objset_spa(dn->dn_objset))); in dnode_reallocate()
817 ASSERT(dn->dn_object != DMU_META_DNODE_OBJECT || dmu_tx_private_ok(tx)); in dnode_reallocate()
824 DN_BONUS_SIZE(spa_maxdnodesize(dmu_objset_spa(dn->dn_objset)))); in dnode_reallocate()
827 dnode_free_interior_slots(dn); in dnode_reallocate()
831 dnode_evict_dbufs(dn); in dnode_reallocate()
833 dn->dn_id_flags = 0; in dnode_reallocate()
835 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_reallocate()
836 dnode_setdirty(dn, tx); in dnode_reallocate()
837 if (dn->dn_datablksz != blocksize) { in dnode_reallocate()
839 ASSERT0(dn->dn_maxblkid); in dnode_reallocate()
840 ASSERT(BP_IS_HOLE(&dn->dn_phys->dn_blkptr[0]) || in dnode_reallocate()
841 dnode_block_freed(dn, 0)); in dnode_reallocate()
843 dnode_setdblksz(dn, blocksize); in dnode_reallocate()
844 dn->dn_next_blksz[tx->tx_txg & TXG_MASK] = blocksize; in dnode_reallocate()
846 if (dn->dn_bonuslen != bonuslen) in dnode_reallocate()
847 dn->dn_next_bonuslen[tx->tx_txg & TXG_MASK] = bonuslen; in dnode_reallocate()
855 if (dn->dn_bonustype != bonustype) in dnode_reallocate()
856 dn->dn_next_bonustype[tx->tx_txg & TXG_MASK] = bonustype; in dnode_reallocate()
857 if (dn->dn_nblkptr != nblkptr) in dnode_reallocate()
858 dn->dn_next_nblkptr[tx->tx_txg & TXG_MASK] = nblkptr; in dnode_reallocate()
859 if (dn->dn_phys->dn_flags & DNODE_FLAG_SPILL_BLKPTR && !keep_spill) { in dnode_reallocate()
860 dbuf_rm_spill(dn, tx); in dnode_reallocate()
861 dnode_rm_spill(dn, tx); in dnode_reallocate()
864 rw_exit(&dn->dn_struct_rwlock); in dnode_reallocate()
867 dn->dn_type = ot; in dnode_reallocate()
870 mutex_enter(&dn->dn_mtx); in dnode_reallocate()
871 dn->dn_bonustype = bonustype; in dnode_reallocate()
872 dn->dn_bonuslen = bonuslen; in dnode_reallocate()
873 dn->dn_num_slots = dn_slots; in dnode_reallocate()
874 dn->dn_nblkptr = nblkptr; in dnode_reallocate()
875 dn->dn_checksum = ZIO_CHECKSUM_INHERIT; in dnode_reallocate()
876 dn->dn_compress = ZIO_COMPRESS_INHERIT; in dnode_reallocate()
877 ASSERT3U(dn->dn_nblkptr, <=, DN_MAX_NBLKPTR); in dnode_reallocate()
880 if (dn->dn_bonus) { in dnode_reallocate()
881 dn->dn_bonus->db.db_size = in dnode_reallocate()
882 DN_SLOTS_TO_BONUSLEN(dn->dn_num_slots) - in dnode_reallocate()
883 (dn->dn_nblkptr-1) * sizeof (blkptr_t); in dnode_reallocate()
884 ASSERT(dn->dn_bonuslen <= dn->dn_bonus->db.db_size); in dnode_reallocate()
887 dn->dn_allocated_txg = tx->tx_txg; in dnode_reallocate()
888 mutex_exit(&dn->dn_mtx); in dnode_reallocate()
1256 dnode_t *dn = dnh->dnh_dnode; in dnode_check_slots_free() local
1258 if (dn == DN_SLOT_FREE) { in dnode_check_slots_free()
1260 } else if (DN_SLOT_IS_PTR(dn)) { in dnode_check_slots_free()
1261 mutex_enter(&dn->dn_mtx); in dnode_check_slots_free()
1262 boolean_t can_free = (dn->dn_type == DMU_OT_NONE && in dnode_check_slots_free()
1263 zfs_refcount_is_zero(&dn->dn_holds) && in dnode_check_slots_free()
1264 !DNODE_IS_DIRTY(dn)); in dnode_check_slots_free()
1265 mutex_exit(&dn->dn_mtx); in dnode_check_slots_free()
1303 dnode_free_interior_slots(dnode_t *dn) in dnode_free_interior_slots() argument
1305 dnode_children_t *children = dmu_buf_get_user(&dn->dn_dbuf->db); in dnode_free_interior_slots()
1306 int epb = dn->dn_dbuf->db.db_size >> DNODE_SHIFT; in dnode_free_interior_slots()
1307 int idx = (dn->dn_object & (epb - 1)) + 1; in dnode_free_interior_slots()
1308 int slots = dn->dn_num_slots - 1; in dnode_free_interior_slots()
1327 dnode_t *dn = dnh->dnh_dnode; in dnode_special_close() local
1333 mutex_enter(&dn->dn_mtx); in dnode_special_close()
1334 if (zfs_refcount_count(&dn->dn_holds) > 0) in dnode_special_close()
1335 cv_wait(&dn->dn_nodnholds, &dn->dn_mtx); in dnode_special_close()
1336 mutex_exit(&dn->dn_mtx); in dnode_special_close()
1337 ASSERT3U(zfs_refcount_count(&dn->dn_holds), ==, 0); in dnode_special_close()
1339 ASSERT(dn->dn_dbuf == NULL || in dnode_special_close()
1340 dmu_buf_get_user(&dn->dn_dbuf->db) == NULL); in dnode_special_close()
1342 dnode_destroy(dn); /* implicit zrl_remove() */ in dnode_special_close()
1351 dnode_t *dn; in dnode_special_open() local
1356 dn = dnode_create(os, dnp, NULL, object, dnh); in dnode_special_open()
1357 DNODE_VERIFY(dn); in dnode_special_open()
1371 dnode_t *dn; in dnode_buf_evict_async() local
1385 dn = dnh->dnh_dnode; in dnode_buf_evict_async()
1392 ASSERT(zfs_refcount_is_zero(&dn->dn_holds)); in dnode_buf_evict_async()
1393 ASSERT(zfs_refcount_is_zero(&dn->dn_tx_holds)); in dnode_buf_evict_async()
1395 dnode_destroy(dn); /* implicit zrl_remove() for first slot */ in dnode_buf_evict_async()
1440 dnode_t *mdn, *dn; in dnode_hold_impl() local
1465 dn = DMU_USERUSED_DNODE(os); in dnode_hold_impl()
1467 dn = DMU_GROUPUSED_DNODE(os); in dnode_hold_impl()
1469 dn = DMU_PROJECTUSED_DNODE(os); in dnode_hold_impl()
1470 if (dn == NULL) in dnode_hold_impl()
1472 type = dn->dn_type; in dnode_hold_impl()
1477 DNODE_VERIFY(dn); in dnode_hold_impl()
1480 (void) zfs_refcount_add(&dn->dn_holds, tag); in dnode_hold_impl()
1481 *dnp = dn; in dnode_hold_impl()
1583 dn = dnh->dnh_dnode; in dnode_hold_impl()
1608 dn = dnh->dnh_dnode; in dnode_hold_impl()
1610 dn = dnode_create(os, dn_block + idx, db, in dnode_hold_impl()
1617 mutex_enter(&dn->dn_mtx); in dnode_hold_impl()
1618 if (dn->dn_type == DMU_OT_NONE || dn->dn_free_txg != 0) { in dnode_hold_impl()
1620 mutex_exit(&dn->dn_mtx); in dnode_hold_impl()
1628 mutex_exit(&dn->dn_mtx); in dnode_hold_impl()
1681 dn = dnh->dnh_dnode; in dnode_hold_impl()
1683 dn = dnode_create(os, dn_block + idx, db, in dnode_hold_impl()
1688 mutex_enter(&dn->dn_mtx); in dnode_hold_impl()
1689 if (!zfs_refcount_is_zero(&dn->dn_holds) || dn->dn_free_txg) { in dnode_hold_impl()
1691 mutex_exit(&dn->dn_mtx); in dnode_hold_impl()
1699 mutex_exit(&dn->dn_mtx); in dnode_hold_impl()
1712 ASSERT0(dn->dn_free_txg); in dnode_hold_impl()
1714 if (zfs_refcount_add(&dn->dn_holds, tag) == 1) in dnode_hold_impl()
1717 mutex_exit(&dn->dn_mtx); in dnode_hold_impl()
1722 DNODE_VERIFY(dn); in dnode_hold_impl()
1724 ASSERT3P(dn->dn_dbuf, ==, db); in dnode_hold_impl()
1725 ASSERT3U(dn->dn_object, ==, object); in dnode_hold_impl()
1728 *dnp = dn; in dnode_hold_impl()
1748 dnode_add_ref(dnode_t *dn, const void *tag) in dnode_add_ref() argument
1750 mutex_enter(&dn->dn_mtx); in dnode_add_ref()
1751 if (zfs_refcount_is_zero(&dn->dn_holds)) { in dnode_add_ref()
1752 mutex_exit(&dn->dn_mtx); in dnode_add_ref()
1755 VERIFY(1 < zfs_refcount_add(&dn->dn_holds, tag)); in dnode_add_ref()
1756 mutex_exit(&dn->dn_mtx); in dnode_add_ref()
1761 dnode_rele(dnode_t *dn, const void *tag) in dnode_rele() argument
1763 mutex_enter(&dn->dn_mtx); in dnode_rele()
1764 dnode_rele_and_unlock(dn, tag, B_FALSE); in dnode_rele()
1768 dnode_rele_and_unlock(dnode_t *dn, const void *tag, boolean_t evicting) in dnode_rele_and_unlock() argument
1772 dmu_buf_impl_t *db = dn->dn_dbuf; in dnode_rele_and_unlock()
1773 dnode_handle_t *dnh = dn->dn_handle; in dnode_rele_and_unlock()
1775 refs = zfs_refcount_remove(&dn->dn_holds, tag); in dnode_rele_and_unlock()
1777 cv_broadcast(&dn->dn_nodnholds); in dnode_rele_and_unlock()
1778 mutex_exit(&dn->dn_mtx); in dnode_rele_and_unlock()
1830 dnode_is_dirty(dnode_t *dn) in dnode_is_dirty() argument
1832 mutex_enter(&dn->dn_mtx); in dnode_is_dirty()
1835 if (multilist_link_active(&dn->dn_dirty_link[i]) || in dnode_is_dirty()
1836 !list_is_empty(&dn->dn_dirty_records[i])) { in dnode_is_dirty()
1837 mutex_exit(&dn->dn_mtx); in dnode_is_dirty()
1842 mutex_exit(&dn->dn_mtx); in dnode_is_dirty()
1848 dnode_setdirty(dnode_t *dn, dmu_tx_t *tx) in dnode_setdirty() argument
1850 objset_t *os = dn->dn_objset; in dnode_setdirty()
1853 if (DMU_OBJECT_IS_SPECIAL(dn->dn_object)) { in dnode_setdirty()
1858 DNODE_VERIFY(dn); in dnode_setdirty()
1861 mutex_enter(&dn->dn_mtx); in dnode_setdirty()
1862 ASSERT(dn->dn_phys->dn_type || dn->dn_allocated_txg); in dnode_setdirty()
1863 ASSERT(dn->dn_free_txg == 0 || dn->dn_free_txg >= txg); in dnode_setdirty()
1864 mutex_exit(&dn->dn_mtx); in dnode_setdirty()
1870 dmu_objset_userquota_get_ids(dn, B_TRUE, tx); in dnode_setdirty()
1873 multilist_sublist_t *mls = multilist_sublist_lock_obj(dirtylist, dn); in dnode_setdirty()
1878 if (multilist_link_active(&dn->dn_dirty_link[txg & TXG_MASK])) { in dnode_setdirty()
1883 ASSERT(!zfs_refcount_is_zero(&dn->dn_holds) || in dnode_setdirty()
1884 !avl_is_empty(&dn->dn_dbufs)); in dnode_setdirty()
1885 ASSERT(dn->dn_datablksz != 0); in dnode_setdirty()
1886 ASSERT0(dn->dn_next_bonuslen[txg & TXG_MASK]); in dnode_setdirty()
1887 ASSERT0(dn->dn_next_blksz[txg & TXG_MASK]); in dnode_setdirty()
1888 ASSERT0(dn->dn_next_bonustype[txg & TXG_MASK]); in dnode_setdirty()
1891 (u_longlong_t)dn->dn_object, (u_longlong_t)txg); in dnode_setdirty()
1893 multilist_sublist_insert_head(mls, dn); in dnode_setdirty()
1906 VERIFY(dnode_add_ref(dn, (void *)(uintptr_t)tx->tx_txg)); in dnode_setdirty()
1908 (void) dbuf_dirty(dn->dn_dbuf, tx); in dnode_setdirty()
1914 dnode_free(dnode_t *dn, dmu_tx_t *tx) in dnode_free() argument
1916 mutex_enter(&dn->dn_mtx); in dnode_free()
1917 if (dn->dn_type == DMU_OT_NONE || dn->dn_free_txg) { in dnode_free()
1918 mutex_exit(&dn->dn_mtx); in dnode_free()
1921 dn->dn_free_txg = tx->tx_txg; in dnode_free()
1922 mutex_exit(&dn->dn_mtx); in dnode_free()
1924 dnode_setdirty(dn, tx); in dnode_free()
1932 dnode_set_blksz(dnode_t *dn, uint64_t size, int ibs, dmu_tx_t *tx) in dnode_set_blksz() argument
1937 ASSERT3U(size, <=, spa_maxblocksize(dmu_objset_spa(dn->dn_objset))); in dnode_set_blksz()
1943 if (ibs == dn->dn_indblkshift) in dnode_set_blksz()
1946 if (size == dn->dn_datablksz && ibs == 0) in dnode_set_blksz()
1949 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_set_blksz()
1952 if (dn->dn_maxblkid != 0) in dnode_set_blksz()
1955 mutex_enter(&dn->dn_dbufs_mtx); in dnode_set_blksz()
1956 for (db = avl_first(&dn->dn_dbufs); db != NULL; in dnode_set_blksz()
1957 db = AVL_NEXT(&dn->dn_dbufs, db)) { in dnode_set_blksz()
1960 mutex_exit(&dn->dn_dbufs_mtx); in dnode_set_blksz()
1964 mutex_exit(&dn->dn_dbufs_mtx); in dnode_set_blksz()
1966 if (ibs && dn->dn_nlevels != 1) in dnode_set_blksz()
1969 dnode_setdirty(dn, tx); in dnode_set_blksz()
1970 if (size != dn->dn_datablksz) { in dnode_set_blksz()
1972 err = dbuf_hold_impl(dn, 0, 0, TRUE, FALSE, FTAG, &db); in dnode_set_blksz()
1979 dnode_setdblksz(dn, size); in dnode_set_blksz()
1980 dn->dn_next_blksz[tx->tx_txg & TXG_MASK] = size; in dnode_set_blksz()
1985 dn->dn_indblkshift = ibs; in dnode_set_blksz()
1986 dn->dn_next_indblkshift[tx->tx_txg & TXG_MASK] = ibs; in dnode_set_blksz()
1989 rw_exit(&dn->dn_struct_rwlock); in dnode_set_blksz()
1993 rw_exit(&dn->dn_struct_rwlock); in dnode_set_blksz()
1998 dnode_set_nlevels_impl(dnode_t *dn, int new_nlevels, dmu_tx_t *tx) in dnode_set_nlevels_impl() argument
2001 int old_nlevels = dn->dn_nlevels; in dnode_set_nlevels_impl()
2006 ASSERT(RW_WRITE_HELD(&dn->dn_struct_rwlock)); in dnode_set_nlevels_impl()
2008 ASSERT3U(new_nlevels, >, dn->dn_nlevels); in dnode_set_nlevels_impl()
2009 dn->dn_nlevels = new_nlevels; in dnode_set_nlevels_impl()
2011 ASSERT3U(new_nlevels, >, dn->dn_next_nlevels[txgoff]); in dnode_set_nlevels_impl()
2012 dn->dn_next_nlevels[txgoff] = new_nlevels; in dnode_set_nlevels_impl()
2015 db = dbuf_hold_level(dn, old_nlevels, 0, FTAG); in dnode_set_nlevels_impl()
2021 mutex_enter(&dn->dn_mtx); in dnode_set_nlevels_impl()
2023 list = &dn->dn_dirty_records[txgoff]; in dnode_set_nlevels_impl()
2025 dr_next = list_next(&dn->dn_dirty_records[txgoff], dr); in dnode_set_nlevels_impl()
2032 list_remove(&dn->dn_dirty_records[txgoff], dr); in dnode_set_nlevels_impl()
2038 mutex_exit(&dn->dn_mtx); in dnode_set_nlevels_impl()
2042 dnode_set_nlevels(dnode_t *dn, int nlevels, dmu_tx_t *tx) in dnode_set_nlevels() argument
2046 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_set_nlevels()
2048 if (dn->dn_nlevels == nlevels) { in dnode_set_nlevels()
2051 } else if (nlevels < dn->dn_nlevels) { in dnode_set_nlevels()
2056 dnode_set_nlevels_impl(dn, nlevels, tx); in dnode_set_nlevels()
2059 rw_exit(&dn->dn_struct_rwlock); in dnode_set_nlevels()
2065 dnode_new_blkid(dnode_t *dn, uint64_t blkid, dmu_tx_t *tx, boolean_t have_read, in dnode_new_blkid() argument
2074 RW_READ_HELD(&dn->dn_struct_rwlock) : in dnode_new_blkid()
2075 RW_WRITE_HELD(&dn->dn_struct_rwlock)); in dnode_new_blkid()
2082 if (blkid <= dn->dn_maxblkid) in dnode_new_blkid()
2085 if (!rw_tryupgrade(&dn->dn_struct_rwlock)) { in dnode_new_blkid()
2086 rw_exit(&dn->dn_struct_rwlock); in dnode_new_blkid()
2087 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_new_blkid()
2095 if (!force && blkid <= dn->dn_maxblkid) in dnode_new_blkid()
2103 dn->dn_maxblkid = blkid; in dnode_new_blkid()
2104 dn->dn_next_maxblkid[tx->tx_txg & TXG_MASK] = in dnode_new_blkid()
2112 epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; in dnode_new_blkid()
2113 for (sz = dn->dn_nblkptr; in dnode_new_blkid()
2114 sz <= blkid && sz >= dn->dn_nblkptr; sz <<= epbs) in dnode_new_blkid()
2120 if (new_nlevels > dn->dn_nlevels) in dnode_new_blkid()
2121 dnode_set_nlevels_impl(dn, new_nlevels, tx); in dnode_new_blkid()
2123 ASSERT3U(dn->dn_nlevels, >=, new_nlevels); in dnode_new_blkid()
2128 rw_downgrade(&dn->dn_struct_rwlock); in dnode_new_blkid()
2132 dnode_dirty_l1(dnode_t *dn, uint64_t l1blkid, dmu_tx_t *tx) in dnode_dirty_l1() argument
2134 dmu_buf_impl_t *db = dbuf_hold_level(dn, 1, l1blkid, FTAG); in dnode_dirty_l1()
2146 dnode_dirty_l1range(dnode_t *dn, uint64_t start_blkid, uint64_t end_blkid, in dnode_dirty_l1range() argument
2155 mutex_enter(&dn->dn_dbufs_mtx); in dnode_dirty_l1range()
2162 db = avl_find(&dn->dn_dbufs, db_search, &where); in dnode_dirty_l1range()
2164 db = avl_nearest(&dn->dn_dbufs, where, AVL_AFTER); in dnode_dirty_l1range()
2185 mutex_exit(&dn->dn_dbufs_mtx); in dnode_dirty_l1range()
2186 dnode_dirty_l1(dn, db->db_blkid, tx); in dnode_dirty_l1range()
2187 mutex_enter(&dn->dn_dbufs_mtx); in dnode_dirty_l1range()
2197 db = avl_find(&dn->dn_dbufs, db_search, &where); in dnode_dirty_l1range()
2199 db = avl_nearest(&dn->dn_dbufs, where, AVL_AFTER); in dnode_dirty_l1range()
2200 for (; db != NULL; db = AVL_NEXT(&dn->dn_dbufs, db)) { in dnode_dirty_l1range()
2208 mutex_exit(&dn->dn_dbufs_mtx); in dnode_dirty_l1range()
2212 dnode_set_dirtyctx(dnode_t *dn, dmu_tx_t *tx, const void *tag) in dnode_set_dirtyctx() argument
2218 if (dn->dn_dirtyctx == DN_UNDIRTIED) { in dnode_set_dirtyctx()
2219 dsl_dataset_t *ds = dn->dn_objset->os_dsl_dataset; in dnode_set_dirtyctx()
2224 if (!BP_IS_HOLE(dn->dn_objset->os_rootbp)) { in dnode_set_dirtyctx()
2226 dn->dn_dirtyctx = DN_DIRTY_SYNC; in dnode_set_dirtyctx()
2228 dn->dn_dirtyctx = DN_DIRTY_OPEN; in dnode_set_dirtyctx()
2229 dn->dn_dirtyctx_firstset = tag; in dnode_set_dirtyctx()
2238 dnode_partial_zero(dnode_t *dn, uint64_t off, uint64_t blkoff, uint64_t len, in dnode_partial_zero() argument
2244 rw_enter(&dn->dn_struct_rwlock, RW_READER); in dnode_partial_zero()
2245 res = dbuf_hold_impl(dn, 0, dbuf_whichblock(dn, 0, off), TRUE, FALSE, in dnode_partial_zero()
2247 rw_exit(&dn->dn_struct_rwlock); in dnode_partial_zero()
2269 dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx) in dnode_free_range() argument
2276 blksz = dn->dn_datablksz; in dnode_free_range()
2277 blkshift = dn->dn_datablkshift; in dnode_free_range()
2278 epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; in dnode_free_range()
2291 if ((off >> blkshift) > dn->dn_maxblkid) in dnode_free_range()
2294 ASSERT(dn->dn_maxblkid == 0); in dnode_free_range()
2301 if (dn->dn_nlevels > 1) { in dnode_free_range()
2302 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_free_range()
2303 dnode_dirty_l1(dn, 0, tx); in dnode_free_range()
2304 rw_exit(&dn->dn_struct_rwlock); in dnode_free_range()
2322 dnode_partial_zero(dn, off, blkoff, head, tx); in dnode_free_range()
2332 if ((off >> blkshift) > dn->dn_maxblkid) in dnode_free_range()
2346 dnode_partial_zero(dn, off + len, 0, tail, tx); in dnode_free_range()
2381 if (dn->dn_nlevels > 1) { in dnode_free_range()
2382 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); in dnode_free_range()
2386 dnode_dirty_l1(dn, first, tx); in dnode_free_range()
2388 last = dn->dn_maxblkid >> epbs; in dnode_free_range()
2392 dnode_dirty_l1(dn, last, tx); in dnode_free_range()
2394 dnode_dirty_l1range(dn, first, last, tx); in dnode_free_range()
2396 int shift = dn->dn_datablkshift + dn->dn_indblkshift - in dnode_free_range()
2406 int err = dnode_next_offset(dn, DNODE_FIND_HAVELOCK, in dnode_free_range()
2425 dnode_dirty_l1(dn, i, tx); in dnode_free_range()
2427 rw_exit(&dn->dn_struct_rwlock); in dnode_free_range()
2435 mutex_enter(&dn->dn_mtx); in dnode_free_range()
2438 if (dn->dn_free_ranges[txgoff] == NULL) { in dnode_free_range()
2439 dn->dn_free_ranges[txgoff] = zfs_range_tree_create(NULL, in dnode_free_range()
2442 zfs_range_tree_clear(dn->dn_free_ranges[txgoff], blkid, nblks); in dnode_free_range()
2443 zfs_range_tree_add(dn->dn_free_ranges[txgoff], blkid, nblks); in dnode_free_range()
2445 dprintf_dnode(dn, "blkid=%llu nblks=%llu txg=%llu\n", in dnode_free_range()
2448 mutex_exit(&dn->dn_mtx); in dnode_free_range()
2450 dbuf_free_range(dn, blkid, blkid + nblks - 1, tx); in dnode_free_range()
2451 dnode_setdirty(dn, tx); in dnode_free_range()
2455 dnode_spill_freed(dnode_t *dn) in dnode_spill_freed() argument
2459 mutex_enter(&dn->dn_mtx); in dnode_spill_freed()
2461 if (dn->dn_rm_spillblk[i] == DN_KILL_SPILLBLK) in dnode_spill_freed()
2464 mutex_exit(&dn->dn_mtx); in dnode_spill_freed()
2470 dnode_block_freed(dnode_t *dn, uint64_t blkid) in dnode_block_freed() argument
2477 if (dn->dn_free_txg) in dnode_block_freed()
2481 return (dnode_spill_freed(dn)); in dnode_block_freed()
2483 mutex_enter(&dn->dn_mtx); in dnode_block_freed()
2485 if (dn->dn_free_ranges[i] != NULL && in dnode_block_freed()
2486 zfs_range_tree_contains(dn->dn_free_ranges[i], blkid, 1)) in dnode_block_freed()
2489 mutex_exit(&dn->dn_mtx); in dnode_block_freed()
2495 dnode_diduse_space(dnode_t *dn, int64_t delta) in dnode_diduse_space() argument
2498 dprintf_dnode(dn, "dn=%p dnp=%p used=%llu delta=%lld\n", in dnode_diduse_space()
2499 dn, dn->dn_phys, in dnode_diduse_space()
2500 (u_longlong_t)dn->dn_phys->dn_used, in dnode_diduse_space()
2503 mutex_enter(&dn->dn_mtx); in dnode_diduse_space()
2504 space = DN_USED_BYTES(dn->dn_phys); in dnode_diduse_space()
2511 if (spa_version(dn->dn_objset->os_spa) < SPA_VERSION_DNODE_BYTES) { in dnode_diduse_space()
2512 ASSERT((dn->dn_phys->dn_flags & DNODE_FLAG_USED_BYTES) == 0); in dnode_diduse_space()
2514 dn->dn_phys->dn_used = space >> DEV_BSHIFT; in dnode_diduse_space()
2516 dn->dn_phys->dn_used = space; in dnode_diduse_space()
2517 dn->dn_phys->dn_flags |= DNODE_FLAG_USED_BYTES; in dnode_diduse_space()
2519 mutex_exit(&dn->dn_mtx); in dnode_diduse_space()
2541 dnode_next_offset_level(dnode_t *dn, int flags, uint64_t *offset, in dnode_next_offset_level() argument
2546 uint64_t epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT; in dnode_next_offset_level()
2552 ASSERT(RW_LOCK_HELD(&dn->dn_struct_rwlock)); in dnode_next_offset_level()
2558 if (lvl == dn->dn_phys->dn_nlevels) { in dnode_next_offset_level()
2560 epb = dn->dn_phys->dn_nblkptr; in dnode_next_offset_level()
2561 data = dn->dn_phys->dn_blkptr; in dnode_next_offset_level()
2563 uint64_t blkid = dbuf_whichblock(dn, lvl, *offset); in dnode_next_offset_level()
2564 error = dbuf_hold_impl(dn, lvl, blkid, TRUE, FALSE, FTAG, &db); in dnode_next_offset_level()
2601 ASSERT(dn->dn_type == DMU_OT_DNODE); in dnode_next_offset_level()
2618 span = (lvl - 1) * epbs + dn->dn_datablkshift; in dnode_next_offset_level()
2629 ASSERT3U((lvl - 1), ==, dn->dn_phys->dn_nlevels - 1); in dnode_next_offset_level()
2680 * dnode_next_offset(dn, flags, offset, 1, 1, 0);
2695 dnode_next_offset(dnode_t *dn, int flags, uint64_t *offset, in dnode_next_offset() argument
2703 rw_enter(&dn->dn_struct_rwlock, RW_READER); in dnode_next_offset()
2705 if (dn->dn_phys->dn_nlevels == 0) { in dnode_next_offset()
2710 if (dn->dn_datablkshift == 0) { in dnode_next_offset()
2711 if (*offset < dn->dn_datablksz) { in dnode_next_offset()
2713 *offset = dn->dn_datablksz; in dnode_next_offset()
2720 maxlvl = dn->dn_phys->dn_nlevels; in dnode_next_offset()
2723 error = dnode_next_offset_level(dn, in dnode_next_offset()
2730 error = dnode_next_offset_level(dn, in dnode_next_offset()
2748 rw_exit(&dn->dn_struct_rwlock); in dnode_next_offset()