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

Function vdev_dtl_required

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

* Determine whether the specified vdev can be offlined/detached/removed * without losing data. */

Source from the content-addressed store, hash-verified

3160 * without losing data.
3161 */
3162boolean_t
3163vdev_dtl_required(vdev_t *vd)
3164{
3165 spa_t *spa = vd->vdev_spa;
3166 vdev_t *tvd = vd->vdev_top;
3167 uint8_t cant_read = vd->vdev_cant_read;
3168 boolean_t required;
3169
3170 ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL);
3171
3172 if (vd == spa->spa_root_vdev || vd == tvd)
3173 return (B_TRUE);
3174
3175 /*
3176 * Temporarily mark the device as unreadable, and then determine
3177 * whether this results in any DTL outages in the top-level vdev.
3178 * If not, we can safely offline/detach/remove the device.
3179 */
3180 vd->vdev_cant_read = B_TRUE;
3181 vdev_dtl_reassess(tvd, 0, 0, B_FALSE, B_FALSE);
3182 required = !vdev_dtl_empty(tvd, DTL_OUTAGE);
3183 vd->vdev_cant_read = cant_read;
3184 vdev_dtl_reassess(tvd, 0, 0, B_FALSE, B_FALSE);
3185
3186 if (!required && zio_injection_enabled) {
3187 required = !!zio_handle_device_injection(vd, NULL,
3188 SET_ERROR(ECHILD));
3189 }
3190
3191 return (required);
3192}
3193
3194/*
3195 * Determine if resilver is needed, and if so the txg range.

Callers 7

vdev_faultFunction · 0.85
vdev_offline_lockedFunction · 0.85
spa_vdev_detachFunction · 0.85
spa_vdev_split_mirrorFunction · 0.85
spa_vdev_resilver_doneFunction · 0.85
dump_dtlFunction · 0.85

Calls 4

spa_config_heldFunction · 0.85
vdev_dtl_reassessFunction · 0.85
vdev_dtl_emptyFunction · 0.85

Tested by

no test coverage detected