MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dnode_destroy

Function dnode_destroy

freebsd/contrib/openzfs/module/zfs/dnode.c:518–571  ·  view source on GitHub ↗

* Caller must be holding the dnode handle, which is released upon return. */

Source from the content-addressed store, hash-verified

516 * Caller must be holding the dnode handle, which is released upon return.
517 */
518static void
519dnode_destroy(dnode_t *dn)
520{
521 objset_t *os = dn->dn_objset;
522 boolean_t complete_os_eviction = B_FALSE;
523
524 ASSERT((dn->dn_id_flags & DN_ID_NEW_EXIST) == 0);
525
526 mutex_enter(&os->os_lock);
527 POINTER_INVALIDATE(&dn->dn_objset);
528 if (!DMU_OBJECT_IS_SPECIAL(dn->dn_object)) {
529 list_remove(&os->os_dnodes, dn);
530 complete_os_eviction =
531 list_is_empty(&os->os_dnodes) &&
532 list_link_active(&os->os_evicting_node);
533 }
534 mutex_exit(&os->os_lock);
535
536 /* the dnode can no longer move, so we can release the handle */
537 if (!zrl_is_locked(&dn->dn_handle->dnh_zrlock))
538 zrl_remove(&dn->dn_handle->dnh_zrlock);
539
540 dn->dn_allocated_txg = 0;
541 dn->dn_free_txg = 0;
542 dn->dn_assigned_txg = 0;
543 dn->dn_dirty_txg = 0;
544
545 dn->dn_dirtyctx = 0;
546 dn->dn_dirtyctx_firstset = NULL;
547 if (dn->dn_bonus != NULL) {
548 mutex_enter(&dn->dn_bonus->db_mtx);
549 dbuf_destroy(dn->dn_bonus);
550 dn->dn_bonus = NULL;
551 }
552 dn->dn_zio = NULL;
553
554 dn->dn_have_spill = B_FALSE;
555 dn->dn_oldused = 0;
556 dn->dn_oldflags = 0;
557 dn->dn_olduid = 0;
558 dn->dn_oldgid = 0;
559 dn->dn_oldprojid = ZFS_DEFAULT_PROJID;
560 dn->dn_newuid = 0;
561 dn->dn_newgid = 0;
562 dn->dn_newprojid = ZFS_DEFAULT_PROJID;
563 dn->dn_id_flags = 0;
564
565 dmu_zfetch_fini(&dn->dn_zfetch);
566 kmem_cache_free(dnode_cache, dn);
567 arc_space_return(sizeof (dnode_t), ARC_SPACE_DNODE);
568
569 if (complete_os_eviction)
570 dmu_objset_evict_done(os);
571}
572
573void
574dnode_allocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, int ibs,

Callers 3

dnode_reclaim_slotsFunction · 0.85
dnode_special_closeFunction · 0.85
dnode_buf_evict_asyncFunction · 0.85

Calls 12

mutex_enterFunction · 0.85
mutex_exitFunction · 0.85
zrl_is_lockedFunction · 0.85
zrl_removeFunction · 0.85
dbuf_destroyFunction · 0.85
dmu_zfetch_finiFunction · 0.85
kmem_cache_freeFunction · 0.85
arc_space_returnFunction · 0.85
dmu_objset_evict_doneFunction · 0.85
list_removeFunction · 0.50
list_is_emptyFunction · 0.50
list_link_activeFunction · 0.50

Tested by

no test coverage detected