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

Function vdev_resilver_needed

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

* Determine if resilver is needed, and if so the txg range. */

Source from the content-addressed store, hash-verified

3195 * Determine if resilver is needed, and if so the txg range.
3196 */
3197boolean_t
3198vdev_resilver_needed(vdev_t *vd, uint64_t *minp, uint64_t *maxp)
3199{
3200 boolean_t needed = B_FALSE;
3201 uint64_t thismin = UINT64_MAX;
3202 uint64_t thismax = 0;
3203
3204 if (vd->vdev_children == 0) {
3205 mutex_enter(&vd->vdev_dtl_lock);
3206 if (!range_tree_is_empty(vd->vdev_dtl[DTL_MISSING]) &&
3207 vdev_writeable(vd)) {
3208
3209 thismin = vdev_dtl_min(vd);
3210 thismax = vdev_dtl_max(vd);
3211 needed = B_TRUE;
3212 }
3213 mutex_exit(&vd->vdev_dtl_lock);
3214 } else {
3215 for (int c = 0; c < vd->vdev_children; c++) {
3216 vdev_t *cvd = vd->vdev_child[c];
3217 uint64_t cmin, cmax;
3218
3219 if (vdev_resilver_needed(cvd, &cmin, &cmax)) {
3220 thismin = MIN(thismin, cmin);
3221 thismax = MAX(thismax, cmax);
3222 needed = B_TRUE;
3223 }
3224 }
3225 }
3226
3227 if (needed && minp) {
3228 *minp = thismin;
3229 *maxp = thismax;
3230 }
3231 return (needed);
3232}
3233
3234/*
3235 * Gets the checkpoint space map object from the vdev's ZAP. On success sm_obj

Callers 11

vdev_rebuild_reset_syncFunction · 0.85
spa_load_implFunction · 0.85
spa_vdev_split_mirrorFunction · 0.85
spa_scanFunction · 0.85
dsl_scan_setup_syncFunction · 0.85
dsl_scan_syncFunction · 0.85
dsl_scan_assess_vdevFunction · 0.85
ztest_fault_injectFunction · 0.85

Calls 6

mutex_enterFunction · 0.85
range_tree_is_emptyFunction · 0.85
vdev_writeableFunction · 0.85
vdev_dtl_minFunction · 0.85
vdev_dtl_maxFunction · 0.85
mutex_exitFunction · 0.85

Tested by 1

ztest_fault_injectFunction · 0.68