svn commit: r331706 - vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zdb vendor/illumos/dist/cmd/zpoo...
Alexander Motin
mav at FreeBSD.org
Wed Mar 28 22:16:53 UTC 2018
Author: mav
Date: Wed Mar 28 22:16:51 2018
New Revision: 331706
URL: https://svnweb.freebsd.org/changeset/base/331706
Log:
9235 rename zpool_rewind_policy_t to zpool_load_policy_t
illumos/illumos-gate at 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 at delphix.com>
Reviewed by: George Wilson <george.wilson at delphix.com>
Approved by: Robert Mustacchi <rm at joyent.com>
Author: Pavel Zakharov <pavel.zakharov at delphix.com>
Modified:
vendor/illumos/dist/cmd/zdb/zdb.c
vendor/illumos/dist/cmd/zpool/zpool_main.c
vendor/illumos/dist/lib/libzfs/common/libzfs.h
vendor/illumos/dist/lib/libzfs/common/libzfs_import.c
vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c
Changes in other areas also in this revision:
Modified:
vendor-sys/illumos/dist/common/zfs/zfs_comutil.c
vendor-sys/illumos/dist/common/zfs/zfs_comutil.h
vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h
Modified: vendor/illumos/dist/cmd/zdb/zdb.c
==============================================================================
--- vendor/illumos/dist/cmd/zdb/zdb.c Wed Mar 28 22:10:06 2018 (r331705)
+++ vendor/illumos/dist/cmd/zdb/zdb.c Wed Mar 28 22:16:51 2018 (r331706)
@@ -5183,8 +5183,8 @@ main(int argc, char **argv)
(dump_opt['X'] ? ZPOOL_EXTREME_REWIND : 0);
if (nvlist_alloc(&policy, NV_UNIQUE_NAME_TYPE, 0) != 0 ||
- nvlist_add_uint64(policy, ZPOOL_REWIND_REQUEST_TXG, max_txg) != 0 ||
- nvlist_add_uint32(policy, ZPOOL_REWIND_REQUEST, rewind) != 0)
+ nvlist_add_uint64(policy, ZPOOL_LOAD_REQUEST_TXG, max_txg) != 0 ||
+ nvlist_add_uint32(policy, ZPOOL_LOAD_REWIND_POLICY, rewind) != 0)
fatal("internal error: %s", strerror(ENOMEM));
error = 0;
@@ -5201,7 +5201,7 @@ main(int argc, char **argv)
}
if (nvlist_add_nvlist(cfg,
- ZPOOL_REWIND_POLICY, policy) != 0) {
+ ZPOOL_LOAD_POLICY, policy) != 0) {
fatal("can't open '%s': %s",
target, strerror(ENOMEM));
}
Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c
==============================================================================
--- vendor/illumos/dist/cmd/zpool/zpool_main.c Wed Mar 28 22:10:06 2018 (r331705)
+++ vendor/illumos/dist/cmd/zpool/zpool_main.c Wed Mar 28 22:16:51 2018 (r331706)
@@ -2325,8 +2325,9 @@ zpool_do_import(int argc, char **argv)
/* In the future, we can capture further policy and include it here */
if (nvlist_alloc(&policy, NV_UNIQUE_NAME, 0) != 0 ||
- nvlist_add_uint64(policy, ZPOOL_REWIND_REQUEST_TXG, txg) != 0 ||
- nvlist_add_uint32(policy, ZPOOL_REWIND_REQUEST, rewind_policy) != 0)
+ nvlist_add_uint64(policy, ZPOOL_LOAD_REQUEST_TXG, txg) != 0 ||
+ nvlist_add_uint32(policy, ZPOOL_LOAD_REWIND_POLICY,
+ rewind_policy) != 0)
goto error;
if (searchdirs == NULL) {
@@ -2451,7 +2452,7 @@ zpool_do_import(int argc, char **argv)
if (do_destroyed && pool_state != POOL_STATE_DESTROYED)
continue;
- verify(nvlist_add_nvlist(config, ZPOOL_REWIND_POLICY,
+ verify(nvlist_add_nvlist(config, ZPOOL_LOAD_POLICY,
policy) == 0);
if (argc == 0) {
@@ -3939,8 +3940,10 @@ zpool_do_clear(int argc, char **argv)
/* In future, further rewind policy choices can be passed along here */
if (nvlist_alloc(&policy, NV_UNIQUE_NAME, 0) != 0 ||
- nvlist_add_uint32(policy, ZPOOL_REWIND_REQUEST, rewind_policy) != 0)
+ nvlist_add_uint32(policy, ZPOOL_LOAD_REWIND_POLICY,
+ rewind_policy) != 0) {
return (1);
+ }
pool = argv[0];
device = argc == 2 ? argv[1] : NULL;
Modified: vendor/illumos/dist/lib/libzfs/common/libzfs.h
==============================================================================
--- vendor/illumos/dist/lib/libzfs/common/libzfs.h Wed Mar 28 22:10:06 2018 (r331705)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs.h Wed Mar 28 22:16:51 2018 (r331706)
@@ -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 *);
Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_import.c
==============================================================================
--- vendor/illumos/dist/lib/libzfs/common/libzfs_import.c Wed Mar 28 22:10:06 2018 (r331705)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_import.c Wed Mar 28 22:16:51 2018 (r331706)
@@ -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, boo
}
if (policy != NULL) {
- if (nvlist_add_nvlist(config, ZPOOL_REWIND_POLICY,
+ if (nvlist_add_nvlist(config, ZPOOL_LOAD_POLICY,
policy) != 0)
goto nomem;
}
Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c
==============================================================================
--- vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Wed Mar 28 22:10:06 2018 (r331705)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Wed Mar 28 22:16:51 2018 (r331706)
@@ -1714,7 +1714,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *con
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 *con
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 *con
* 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 *con
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, nvl
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, nvl
&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, nvl
}
}
- 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);
}
More information about the svn-src-vendor
mailing list