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

Function vdev_reopen

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

* Reopen all interior vdevs and any unopened leaves. We don't actually * reopen leaf vdevs which had previously been opened as they might deadlock * on the spa_config_lock. Instead we only obtain the leaf's physical size. * If the leaf has never been opened then open it, as usual. */

Source from the content-addressed store, hash-verified

2415 * If the leaf has never been opened then open it, as usual.
2416 */
2417void
2418vdev_reopen(vdev_t *vd)
2419{
2420 spa_t *spa = vd->vdev_spa;
2421
2422 ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL);
2423
2424 /* set the reopening flag unless we're taking the vdev offline */
2425 vd->vdev_reopening = !vd->vdev_offline;
2426 vdev_close(vd);
2427 (void) vdev_open(vd);
2428
2429 /*
2430 * Call vdev_validate() here to make sure we have the same device.
2431 * Otherwise, a device with an invalid label could be successfully
2432 * opened in response to vdev_reopen().
2433 */
2434 if (vd->vdev_aux) {
2435 (void) vdev_validate_aux(vd);
2436 if (vdev_readable(vd) && vdev_writeable(vd) &&
2437 vd->vdev_aux == &spa->spa_l2cache) {
2438 /*
2439 * In case the vdev is present we should evict all ARC
2440 * buffers and pointers to log blocks and reclaim their
2441 * space before restoring its contents to L2ARC.
2442 */
2443 if (l2arc_vdev_present(vd)) {
2444 l2arc_rebuild_vdev(vd, B_TRUE);
2445 } else {
2446 l2arc_add_vdev(spa, vd);
2447 }
2448 spa_async_request(spa, SPA_ASYNC_L2CACHE_REBUILD);
2449 spa_async_request(spa, SPA_ASYNC_L2CACHE_TRIM);
2450 }
2451 } else {
2452 (void) vdev_validate(vd);
2453 }
2454
2455 /*
2456 * Reassess parent vdev's health.
2457 */
2458 vdev_propagate_state(vd);
2459}
2460
2461int
2462vdev_create(vdev_t *vd, uint64_t txg, boolean_t isreplacing)

Callers 12

zfs_ioc_pool_reopenFunction · 0.85
vdev_faultFunction · 0.85
vdev_onlineFunction · 0.85
vdev_offline_lockedFunction · 0.85
vdev_clearFunction · 0.85
spa_try_repairFunction · 0.85
spa_vdev_detachFunction · 0.85
spa_vdev_split_mirrorFunction · 0.85
spa_async_probeFunction · 0.85
dsl_scanFunction · 0.85
ztest_vdev_attach_detachFunction · 0.85

Calls 12

spa_config_heldFunction · 0.85
vdev_closeFunction · 0.85
vdev_openFunction · 0.85
vdev_validate_auxFunction · 0.85
vdev_readableFunction · 0.85
vdev_writeableFunction · 0.85
l2arc_vdev_presentFunction · 0.85
l2arc_rebuild_vdevFunction · 0.85
l2arc_add_vdevFunction · 0.85
spa_async_requestFunction · 0.85
vdev_validateFunction · 0.85
vdev_propagate_stateFunction · 0.85

Tested by 1

ztest_vdev_attach_detachFunction · 0.68