diff options
author | George Melikov <[email protected]> | 2017-01-31 21:13:10 +0300 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-01-31 10:13:10 -0800 |
commit | ed828c0c375477ff27d5fa9a7bf46ae6b6f2e57a (patch) | |
tree | 09347b9e65fb56cd28afbe2ac3b1e29f0d175bc0 /cmd/zdb | |
parent | 41425f79dabc58e5ddb16cc701cc435a5480e56a (diff) |
OpenZFS 7280 - Allow changing global libzpool variables in zdb and ztest through command line
Authored by: Pavel Zakharov <[email protected]>
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: Dan Kimmel <[email protected]>
Approved by: Robert Mustacchi <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Ported-by: George Melikov <[email protected]>
OpenZFS-issue: https://www.illumos.org/issues/7280
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/0e60744
Closes #5676
Diffstat (limited to 'cmd/zdb')
-rw-r--r-- | cmd/zdb/zdb.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index 6a36aa1ef..10bca4a91 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -127,7 +127,8 @@ usage(void) { (void) fprintf(stderr, "Usage: %s [-CumMdibcsDvhLXFPAG] [-t txg] [-e [-p path...]] " - "[-U config] [-I inflight I/Os] [-x dumpdir] poolname [object...]\n" + "[-U config] [-I inflight I/Os] [-x dumpdir] [-o var=value] " + "poolname [object...]\n" " %s [-divPA] [-e -p path...] [-U config] dataset " "[object...]\n" " %s -mM [-LXFPA] [-t txg] [-e [-p path...]] [-U config] " @@ -189,6 +190,8 @@ usage(void) "checksumming I/Os [default is 200]\n"); (void) fprintf(stderr, " -G dump zfs_dbgmsg buffer before " "exiting\n"); + (void) fprintf(stderr, " -o <variable>=<value> set global " + "variable to an unsigned 32-bit integer value\n"); (void) fprintf(stderr, "Specify an option more than once (e.g. -bb) " "to make only that option verbose\n"); (void) fprintf(stderr, "Default is to dump everything non-verbosely\n"); @@ -3707,7 +3710,7 @@ main(int argc, char **argv) spa_config_path = spa_config_path_env; while ((c = getopt(argc, argv, - "bcdhilmMI:suCDRSAFLXx:evp:t:U:PVG")) != -1) { + "bcdhilmMI:suCDRSAFLXx:evp:t:U:PVGo")) != -1) { switch (c) { case 'b': case 'c': @@ -3762,9 +3765,6 @@ main(int argc, char **argv) } searchdirs[nsearch++] = optarg; break; - case 'x': - vn_dumpdir = optarg; - break; case 't': max_txg = strtoull(optarg, NULL, 0); if (max_txg < TXG_INITIAL) { @@ -3779,6 +3779,14 @@ main(int argc, char **argv) case 'v': verbose++; break; + case 'x': + vn_dumpdir = optarg; + break; + case 'o': + error = set_global_var(optarg); + if (error != 0) + usage(); + break; default: usage(); break; |