* Reassess DTLs after a config change or scrub completion. If txg == 0 no * write operations will be issued to the pool. */
| 2809 | * write operations will be issued to the pool. |
| 2810 | */ |
| 2811 | void |
| 2812 | vdev_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 || |
no test coverage detected