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

Function vdev_create

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

Source from the content-addressed store, hash-verified

2459}
2460
2461int
2462vdev_create(vdev_t *vd, uint64_t txg, boolean_t isreplacing)
2463{
2464 int error;
2465
2466 /*
2467 * Normally, partial opens (e.g. of a mirror) are allowed.
2468 * For a create, however, we want to fail the request if
2469 * there are any components we can't open.
2470 */
2471 error = vdev_open(vd);
2472
2473 if (error || vd->vdev_state != VDEV_STATE_HEALTHY) {
2474 vdev_close(vd);
2475 return (error ? error : SET_ERROR(ENXIO));
2476 }
2477
2478 /*
2479 * Recursively load DTLs and initialize all labels.
2480 */
2481 if ((error = vdev_dtl_load(vd)) != 0 ||
2482 (error = vdev_label_init(vd, txg, isreplacing ?
2483 VDEV_LABEL_REPLACE : VDEV_LABEL_CREATE)) != 0) {
2484 vdev_close(vd);
2485 return (error);
2486 }
2487
2488 return (0);
2489}
2490
2491void
2492vdev_metaslab_set_size(vdev_t *vd)

Callers 3

spa_createFunction · 0.85
spa_vdev_addFunction · 0.85
spa_vdev_attachFunction · 0.85

Calls 4

vdev_openFunction · 0.85
vdev_closeFunction · 0.85
vdev_dtl_loadFunction · 0.85
vdev_label_initFunction · 0.85

Tested by

no test coverage detected