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

Function vdev_close

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

* Close a virtual device. */

Source from the content-addressed store, hash-verified

2347 * Close a virtual device.
2348 */
2349void
2350vdev_close(vdev_t *vd)
2351{
2352 vdev_t *pvd = vd->vdev_parent;
2353 spa_t *spa __maybe_unused = vd->vdev_spa;
2354
2355 ASSERT(vd != NULL);
2356 ASSERT(vd->vdev_open_thread == curthread ||
2357 spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL);
2358
2359 /*
2360 * If our parent is reopening, then we are as well, unless we are
2361 * going offline.
2362 */
2363 if (pvd != NULL && pvd->vdev_reopening)
2364 vd->vdev_reopening = (pvd->vdev_reopening && !vd->vdev_offline);
2365
2366 vd->vdev_ops->vdev_op_close(vd);
2367
2368 vdev_cache_purge(vd);
2369
2370 /*
2371 * We record the previous state before we close it, so that if we are
2372 * doing a reopen(), we don't generate FMA ereports if we notice that
2373 * it's still faulted.
2374 */
2375 vd->vdev_prevstate = vd->vdev_state;
2376
2377 if (vd->vdev_offline)
2378 vd->vdev_state = VDEV_STATE_OFFLINE;
2379 else
2380 vd->vdev_state = VDEV_STATE_CLOSED;
2381 vd->vdev_stat.vs_aux = VDEV_AUX_NONE;
2382}
2383
2384void
2385vdev_hold(vdev_t *vd)

Callers 9

vdev_raidz_closeFunction · 0.85
vdev_root_closeFunction · 0.85
vdev_freeFunction · 0.85
vdev_reopenFunction · 0.85
vdev_createFunction · 0.85
spa_load_sparesFunction · 0.85
spa_ld_trusted_configFunction · 0.85
vdev_draid_closeFunction · 0.85
vdev_mirror_closeFunction · 0.85

Calls 2

spa_config_heldFunction · 0.85
vdev_cache_purgeFunction · 0.85

Tested by

no test coverage detected