mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
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 <pavel.zakharov@delphix.com> Reviewed by: Matt Ahrens <matt@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Approved by: Robert Mustacchi <rm@joyent.com> Ported-by: Brian Behlendorf <behlendorf1@llnl.gov> OpenZFS-issue: https://illumos.org/issues/9235 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/d2b1e44 Closes #7532
This commit is contained in:
committed by
Brian Behlendorf
parent
85912983a4
commit
8a393be353
@@ -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;
|
||||
}
|
||||
|
||||
+11
-11
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user