diff options
author | Pavel Zakharov <[email protected]> | 2017-02-10 17:51:09 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-06-04 14:54:20 -0700 |
commit | 8a393be353c3bfffbfbe0f4d2bc57210b658dcde (patch) | |
tree | 11a6990472970d151bed08414b7d86feb173777b /lib | |
parent | 85912983a4ff12eab20b170c15eb26f7761b8be2 (diff) |
OpenZFS 9235 - rename zpool_rewind_policy_t to zpool_load_policy_t
We want to be able to pass various settings during import/open of a
pool, which are not only related to rewind. Instead of adding a new
policy and duplicate a bunch of code, we should just rename
rewind_policy to a more generic term like load_policy.
For instance, we'd like to set spa->spa_import_flags from the nvlist,
rather from a flags parameter passed to spa_import as in some cases we
want those flags not only for the import case, but also for the open
case. One such flag could be ZFS_IMPORT_MISSING_LOG (as used in zdb)
which would allow zfs to open a pool when logs are missing.
Authored by: Pavel Zakharov <[email protected]>
Reviewed by: Matt Ahrens <[email protected]>
Reviewed by: George Wilson <[email protected]>
Approved by: Robert Mustacchi <[email protected]>
Ported-by: Brian Behlendorf <[email protected]>
OpenZFS-issue: https://illumos.org/issues/9235
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/d2b1e44
Closes #7532
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libzfs/libzfs_import.c | 2 | ||||
-rw-r--r-- | lib/libzfs/libzfs_pool.c | 22 |
2 files changed, 12 insertions, 12 deletions
diff --git a/lib/libzfs/libzfs_import.c b/lib/libzfs/libzfs_import.c index 68b5988cd..7d2f0e903 100644 --- a/lib/libzfs/libzfs_import.c +++ b/lib/libzfs/libzfs_import.c @@ -1232,7 +1232,7 @@ get_configs(libzfs_handle_t *hdl, pool_list_t *pl, boolean_t active_ok, } if (policy != NULL) { - if (nvlist_add_nvlist(config, ZPOOL_REWIND_POLICY, + if (nvlist_add_nvlist(config, ZPOOL_LOAD_POLICY, policy) != 0) goto nomem; } diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index 935b42993..3b16c012f 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -1746,7 +1746,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname, nvlist_t *props, int flags) { zfs_cmd_t zc = {"\0"}; - zpool_rewind_policy_t policy; + zpool_load_policy_t policy; nvlist_t *nv = NULL; nvlist_t *nvinfo = NULL; nvlist_t *missing = NULL; @@ -1818,7 +1818,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname, zcmd_free_nvlists(&zc); - zpool_get_rewind_policy(config, &policy); + zpool_get_load_policy(config, &policy); if (error) { char desc[1024]; @@ -1828,7 +1828,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname, * Dry-run failed, but we print out what success * looks like if we found a best txg */ - if (policy.zrp_request & ZPOOL_TRY_REWIND) { + if (policy.zlp_rewind & ZPOOL_TRY_REWIND) { zpool_rewind_exclaim(hdl, newname ? origname : thename, B_TRUE, nv); nvlist_free(nv); @@ -1968,10 +1968,10 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname, ret = -1; else if (zhp != NULL) zpool_close(zhp); - if (policy.zrp_request & + if (policy.zlp_rewind & (ZPOOL_DO_REWIND | ZPOOL_TRY_REWIND)) { zpool_rewind_exclaim(hdl, newname ? origname : thename, - ((policy.zrp_request & ZPOOL_TRY_REWIND) != 0), nv); + ((policy.zlp_rewind & ZPOOL_TRY_REWIND) != 0), nv); } nvlist_free(nv); return (0); @@ -3341,7 +3341,7 @@ zpool_clear(zpool_handle_t *zhp, const char *path, nvlist_t *rewindnvl) zfs_cmd_t zc = {"\0"}; char msg[1024]; nvlist_t *tgt; - zpool_rewind_policy_t policy; + zpool_load_policy_t policy; boolean_t avail_spare, l2cache; libzfs_handle_t *hdl = zhp->zpool_hdl; nvlist_t *nvi = NULL; @@ -3373,8 +3373,8 @@ zpool_clear(zpool_handle_t *zhp, const char *path, nvlist_t *rewindnvl) &zc.zc_guid) == 0); } - zpool_get_rewind_policy(rewindnvl, &policy); - zc.zc_cookie = policy.zrp_request; + zpool_get_load_policy(rewindnvl, &policy); + zc.zc_cookie = policy.zlp_rewind; if (zcmd_alloc_dst_nvlist(hdl, &zc, zhp->zpool_config_size * 2) != 0) return (-1); @@ -3390,13 +3390,13 @@ zpool_clear(zpool_handle_t *zhp, const char *path, nvlist_t *rewindnvl) } } - if (!error || ((policy.zrp_request & ZPOOL_TRY_REWIND) && + if (!error || ((policy.zlp_rewind & ZPOOL_TRY_REWIND) && errno != EPERM && errno != EACCES)) { - if (policy.zrp_request & + if (policy.zlp_rewind & (ZPOOL_DO_REWIND | ZPOOL_TRY_REWIND)) { (void) zcmd_read_dst_nvlist(hdl, &zc, &nvi); zpool_rewind_exclaim(hdl, zc.zc_name, - ((policy.zrp_request & ZPOOL_TRY_REWIND) != 0), + ((policy.zlp_rewind & ZPOOL_TRY_REWIND) != 0), nvi); nvlist_free(nvi); } |