aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2018-03-28 22:16:51 +0000
committerAlexander Motin <mav@FreeBSD.org>2018-03-28 22:16:51 +0000
commitd32e3273d252390ab3fa47c220b78c17a797e9e2 (patch)
treed26849b142bb9ecdbed5fb56fe793d03992c5582 /lib
parentf5b017d9140d4df1b5928cb505b081f7b383c314 (diff)
downloadsrc-d32e3273d252390ab3fa47c220b78c17a797e9e2.tar.gz
src-d32e3273d252390ab3fa47c220b78c17a797e9e2.zip
9235 rename zpool_rewind_policy_t to zpool_load_policy_t
illumos/illumos-gate@5dafeea3ebd2dd77affc802bcb90f63faf01589f 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. Reviewed by: Matt Ahrens <matt@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Approved by: Robert Mustacchi <rm@joyent.com> Author: Pavel Zakharov <pavel.zakharov@delphix.com>
Notes
Notes: svn path=/vendor-sys/illumos/dist/; revision=331706
Diffstat (limited to 'lib')
-rw-r--r--lib/libzfs/common/libzfs.h2
-rw-r--r--lib/libzfs/common/libzfs_import.c4
-rw-r--r--lib/libzfs/common/libzfs_pool.c22
3 files changed, 14 insertions, 14 deletions
diff --git a/lib/libzfs/common/libzfs.h b/lib/libzfs/common/libzfs.h
index 80603104acbb..1ebaffe9d154 100644
--- a/lib/libzfs/common/libzfs.h
+++ b/lib/libzfs/common/libzfs.h
@@ -393,7 +393,7 @@ typedef struct importargs {
int can_be_active : 1; /* can the pool be active? */
int unique : 1; /* does 'poolname' already exist? */
int exists : 1; /* set on return if pool already exists */
- nvlist_t *policy; /* rewind policy (rewind txg, etc.) */
+ nvlist_t *policy; /* load policy (max txg, rewind, etc.) */
} importargs_t;
extern nvlist_t *zpool_search_import(libzfs_handle_t *, importargs_t *);
diff --git a/lib/libzfs/common/libzfs_import.c b/lib/libzfs/common/libzfs_import.c
index 8cbbd586962e..dbe37944a7ae 100644
--- a/lib/libzfs/common/libzfs_import.c
+++ b/lib/libzfs/common/libzfs_import.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
* Copyright 2015 RackTop Systems.
* Copyright 2017 Nexenta Systems, Inc.
*/
@@ -748,7 +748,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/common/libzfs_pool.c b/lib/libzfs/common/libzfs_pool.c
index 8afb70f83929..10eb3c6a8a25 100644
--- a/lib/libzfs/common/libzfs_pool.c
+++ b/lib/libzfs/common/libzfs_pool.c
@@ -1714,7 +1714,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;
@@ -1786,7 +1786,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];
@@ -1795,7 +1795,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);
@@ -1888,10 +1888,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);
@@ -3268,7 +3268,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;
@@ -3300,8 +3300,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);
@@ -3317,13 +3317,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);
}