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

Function arc_fini

freebsd/contrib/openzfs/module/zfs/arc.c:7706–7770  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7704}
7705
7706void
7707arc_fini(void)
7708{
7709 arc_prune_t *p;
7710
7711#ifdef _KERNEL
7712 arc_lowmem_fini();
7713#endif /* _KERNEL */
7714
7715 /* Use B_TRUE to ensure *all* buffers are evicted */
7716 arc_flush(NULL, B_TRUE);
7717
7718 if (arc_ksp != NULL) {
7719 kstat_delete(arc_ksp);
7720 arc_ksp = NULL;
7721 }
7722
7723 taskq_wait(arc_prune_taskq);
7724 taskq_destroy(arc_prune_taskq);
7725
7726 mutex_enter(&arc_prune_mtx);
7727 while ((p = list_head(&arc_prune_list)) != NULL) {
7728 list_remove(&arc_prune_list, p);
7729 zfs_refcount_remove(&p->p_refcnt, &arc_prune_list);
7730 zfs_refcount_destroy(&p->p_refcnt);
7731 kmem_free(p, sizeof (*p));
7732 }
7733 mutex_exit(&arc_prune_mtx);
7734
7735 list_destroy(&arc_prune_list);
7736 mutex_destroy(&arc_prune_mtx);
7737
7738 (void) zthr_cancel(arc_evict_zthr);
7739 (void) zthr_cancel(arc_reap_zthr);
7740
7741 mutex_destroy(&arc_evict_lock);
7742 list_destroy(&arc_evict_waiters);
7743
7744 /*
7745 * Free any buffers that were tagged for destruction. This needs
7746 * to occur before arc_state_fini() runs and destroys the aggsum
7747 * values which are updated when freeing scatter ABDs.
7748 */
7749 l2arc_do_free_on_write();
7750
7751 /*
7752 * buf_fini() must proceed arc_state_fini() because buf_fin() may
7753 * trigger the release of kmem magazines, which can callback to
7754 * arc_space_return() which accesses aggsums freed in act_state_fini().
7755 */
7756 buf_fini();
7757 arc_state_fini();
7758
7759 arc_unregister_hotplug();
7760
7761 /*
7762 * We destroy the zthrs after all the ARC state has been
7763 * torn down to avoid the case of them receiving any

Callers 1

dmu_finiFunction · 0.85

Calls 15

arc_flushFunction · 0.85
mutex_enterFunction · 0.85
zfs_refcount_removeFunction · 0.85
zfs_refcount_destroyFunction · 0.85
mutex_exitFunction · 0.85
mutex_destroyFunction · 0.85
zthr_cancelFunction · 0.85
l2arc_do_free_on_writeFunction · 0.85
buf_finiFunction · 0.85
arc_state_finiFunction · 0.85
zthr_destroyFunction · 0.85
arc_lowmem_finiFunction · 0.50

Tested by

no test coverage detected