Changeset View
Changeset View
Standalone View
Standalone View
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
Show First 20 Lines • Show All 5,713 Lines • ▼ Show 20 Lines | spa_generate_rootconf(const char *name) | ||||
for (i = 0; i < nchildren; i++) | for (i = 0; i < nchildren; i++) | ||||
nvlist_free(tops[i]); | nvlist_free(tops[i]); | ||||
kmem_free(tops, nchildren * sizeof(void *)); | kmem_free(tops, nchildren * sizeof(void *)); | ||||
nvlist_free(nvroot); | nvlist_free(nvroot); | ||||
return (config); | return (config); | ||||
} | } | ||||
int | int | ||||
spa_import_rootpool(const char *name) | spa_import_rootpool(const char *name, bool checkpointrewind) | ||||
{ | { | ||||
spa_t *spa; | spa_t *spa; | ||||
vdev_t *rvd, *bvd, *avd = NULL; | vdev_t *rvd, *bvd, *avd = NULL; | ||||
nvlist_t *config, *nvtop; | nvlist_t *config, *nvtop; | ||||
uint64_t txg; | uint64_t txg; | ||||
char *pname; | char *pname; | ||||
int error; | int error; | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | if (config != NULL) { | ||||
cmn_err(CE_NOTE, "Cannot find the pool label for '%s'", | cmn_err(CE_NOTE, "Cannot find the pool label for '%s'", | ||||
name); | name); | ||||
return (EIO); | return (EIO); | ||||
} else { | } else { | ||||
VERIFY(nvlist_dup(spa->spa_config, &config, KM_SLEEP) == 0); | VERIFY(nvlist_dup(spa->spa_config, &config, KM_SLEEP) == 0); | ||||
} | } | ||||
spa->spa_is_root = B_TRUE; | spa->spa_is_root = B_TRUE; | ||||
spa->spa_import_flags = ZFS_IMPORT_VERBATIM; | spa->spa_import_flags = ZFS_IMPORT_VERBATIM; | ||||
if (checkpointrewind) { | |||||
spa->spa_import_flags |= ZFS_IMPORT_CHECKPOINT; | |||||
} | |||||
/* | /* | ||||
* Build up a vdev tree based on the boot device's label config. | * Build up a vdev tree based on the boot device's label config. | ||||
*/ | */ | ||||
VERIFY(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, | VERIFY(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, | ||||
&nvtop) == 0); | &nvtop) == 0); | ||||
spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); | spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); | ||||
error = spa_config_parse(spa, &rvd, nvtop, NULL, 0, | error = spa_config_parse(spa, &rvd, nvtop, NULL, 0, | ||||
▲ Show 20 Lines • Show All 3,181 Lines • Show Last 20 Lines |