* Look at the vdev tree and determine whether any devices are currently being * replaced. */
| 5175 | * replaced. |
| 5176 | */ |
| 5177 | boolean_t |
| 5178 | vdev_replace_in_progress(vdev_t *vdev) |
| 5179 | { |
| 5180 | ASSERT(spa_config_held(vdev->vdev_spa, SCL_ALL, RW_READER) != 0); |
| 5181 | |
| 5182 | if (vdev->vdev_ops == &vdev_replacing_ops) |
| 5183 | return (B_TRUE); |
| 5184 | |
| 5185 | /* |
| 5186 | * A 'spare' vdev indicates that we have a replace in progress, unless |
| 5187 | * it has exactly two children, and the second, the hot spare, has |
| 5188 | * finished being resilvered. |
| 5189 | */ |
| 5190 | if (vdev->vdev_ops == &vdev_spare_ops && (vdev->vdev_children > 2 || |
| 5191 | !vdev_dtl_empty(vdev->vdev_child[1], DTL_MISSING))) |
| 5192 | return (B_TRUE); |
| 5193 | |
| 5194 | for (int i = 0; i < vdev->vdev_children; i++) { |
| 5195 | if (vdev_replace_in_progress(vdev->vdev_child[i])) |
| 5196 | return (B_TRUE); |
| 5197 | } |
| 5198 | |
| 5199 | return (B_FALSE); |
| 5200 | } |
| 5201 | |
| 5202 | EXPORT_SYMBOL(vdev_fault); |
| 5203 | EXPORT_SYMBOL(vdev_degrade); |
no test coverage detected