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

Function vdev_degrade

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

* Mark the given vdev degraded. A degraded vdev is purely an indication to the * user that something is wrong. The vdev continues to operate as normal as far * as I/O is concerned. */

Source from the content-addressed store, hash-verified

3686 * as I/O is concerned.
3687 */
3688int
3689vdev_degrade(spa_t *spa, uint64_t guid, vdev_aux_t aux)
3690{
3691 vdev_t *vd;
3692
3693 spa_vdev_state_enter(spa, SCL_NONE);
3694
3695 if ((vd = spa_lookup_by_guid(spa, guid, B_TRUE)) == NULL)
3696 return (spa_vdev_state_exit(spa, NULL, SET_ERROR(ENODEV)));
3697
3698 if (!vd->vdev_ops->vdev_op_leaf)
3699 return (spa_vdev_state_exit(spa, NULL, SET_ERROR(ENOTSUP)));
3700
3701 /*
3702 * If the vdev is already faulted, then don't do anything.
3703 */
3704 if (vd->vdev_faulted || vd->vdev_degraded)
3705 return (spa_vdev_state_exit(spa, NULL, 0));
3706
3707 vd->vdev_degraded = 1ULL;
3708 if (!vdev_is_dead(vd))
3709 vdev_set_state(vd, B_FALSE, VDEV_STATE_DEGRADED,
3710 aux);
3711
3712 return (spa_vdev_state_exit(spa, vd, 0));
3713}
3714
3715/*
3716 * Online the given vdev.

Callers 1

zfs_ioc_vdev_set_stateFunction · 0.85

Calls 5

spa_vdev_state_enterFunction · 0.85
spa_lookup_by_guidFunction · 0.85
spa_vdev_state_exitFunction · 0.85
vdev_is_deadFunction · 0.85
vdev_set_stateFunction · 0.85

Tested by

no test coverage detected