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

Function vdev_dtl_reassess

freebsd/contrib/openzfs/module/zfs/vdev.c:2811–2970  ·  view source on GitHub ↗

* Reassess DTLs after a config change or scrub completion. If txg == 0 no * write operations will be issued to the pool. */

Source from the content-addressed store, hash-verified

2809 * write operations will be issued to the pool.
2810 */
2811void
2812vdev_dtl_reassess(vdev_t *vd, uint64_t txg, uint64_t scrub_txg,
2813 boolean_t scrub_done, boolean_t rebuild_done)
2814{
2815 spa_t *spa = vd->vdev_spa;
2816 avl_tree_t reftree;
2817 int minref;
2818
2819 ASSERT(spa_config_held(spa, SCL_ALL, RW_READER) != 0);
2820
2821 for (int c = 0; c < vd->vdev_children; c++)
2822 vdev_dtl_reassess(vd->vdev_child[c], txg,
2823 scrub_txg, scrub_done, rebuild_done);
2824
2825 if (vd == spa->spa_root_vdev || !vdev_is_concrete(vd) || vd->vdev_aux)
2826 return;
2827
2828 if (vd->vdev_ops->vdev_op_leaf) {
2829 dsl_scan_t *scn = spa->spa_dsl_pool->dp_scan;
2830 vdev_rebuild_t *vr = &vd->vdev_top->vdev_rebuild_config;
2831 boolean_t check_excise = B_FALSE;
2832 boolean_t wasempty = B_TRUE;
2833
2834 mutex_enter(&vd->vdev_dtl_lock);
2835
2836 /*
2837 * If requested, pretend the scan or rebuild completed cleanly.
2838 */
2839 if (zfs_scan_ignore_errors) {
2840 if (scn != NULL)
2841 scn->scn_phys.scn_errors = 0;
2842 if (vr != NULL)
2843 vr->vr_rebuild_phys.vrp_errors = 0;
2844 }
2845
2846 if (scrub_txg != 0 &&
2847 !range_tree_is_empty(vd->vdev_dtl[DTL_MISSING])) {
2848 wasempty = B_FALSE;
2849 zfs_dbgmsg("guid:%llu txg:%llu scrub:%llu started:%d "
2850 "dtl:%llu/%llu errors:%llu",
2851 (u_longlong_t)vd->vdev_guid, (u_longlong_t)txg,
2852 (u_longlong_t)scrub_txg, spa->spa_scrub_started,
2853 (u_longlong_t)vdev_dtl_min(vd),
2854 (u_longlong_t)vdev_dtl_max(vd),
2855 (u_longlong_t)(scn ? scn->scn_phys.scn_errors : 0));
2856 }
2857
2858 /*
2859 * If we've completed a scrub/resilver or a rebuild cleanly
2860 * then determine if this vdev should remove any DTLs. We
2861 * only want to excise regions on vdevs that were available
2862 * during the entire duration of this scan.
2863 */
2864 if (rebuild_done &&
2865 vr != NULL && vr->vr_rebuild_phys.vrp_errors == 0) {
2866 check_excise = B_TRUE;
2867 } else {
2868 if (spa->spa_scrub_started ||

Callers 6

spa_vdev_config_exitFunction · 0.85
spa_vdev_state_exitFunction · 0.85
vdev_dtl_requiredFunction · 0.85
dsl_scan_doneFunction · 0.85

Calls 15

spa_config_heldFunction · 0.85
vdev_is_concreteFunction · 0.85
mutex_enterFunction · 0.85
range_tree_is_emptyFunction · 0.85
vdev_dtl_minFunction · 0.85
vdev_dtl_maxFunction · 0.85
vdev_dtl_should_exciseFunction · 0.85
space_reftree_createFunction · 0.85
space_reftree_add_mapFunction · 0.85
space_reftree_add_segFunction · 0.85
space_reftree_destroyFunction · 0.85

Tested by

no test coverage detected