| 2297 | } |
| 2298 | |
| 2299 | static void |
| 2300 | vdev_copy_path_search(vdev_t *stvd, vdev_t *dvd) |
| 2301 | { |
| 2302 | ASSERT(stvd->vdev_top == stvd); |
| 2303 | ASSERT3U(stvd->vdev_id, ==, dvd->vdev_top->vdev_id); |
| 2304 | |
| 2305 | for (uint64_t i = 0; i < dvd->vdev_children; i++) { |
| 2306 | vdev_copy_path_search(stvd, dvd->vdev_child[i]); |
| 2307 | } |
| 2308 | |
| 2309 | if (!dvd->vdev_ops->vdev_op_leaf || !vdev_is_concrete(dvd)) |
| 2310 | return; |
| 2311 | |
| 2312 | /* |
| 2313 | * The idea here is that while a vdev can shift positions within |
| 2314 | * a top vdev (when replacing, attaching mirror, etc.) it cannot |
| 2315 | * step outside of it. |
| 2316 | */ |
| 2317 | vdev_t *vd = vdev_lookup_by_guid(stvd, dvd->vdev_guid); |
| 2318 | |
| 2319 | if (vd == NULL || vd->vdev_ops != dvd->vdev_ops) |
| 2320 | return; |
| 2321 | |
| 2322 | ASSERT(vd->vdev_ops->vdev_op_leaf); |
| 2323 | |
| 2324 | vdev_copy_path_impl(vd, dvd); |
| 2325 | } |
| 2326 | |
| 2327 | /* |
| 2328 | * Recursively copy vdev paths from one root vdev to another. Source and |
no test coverage detected