mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
zdb: Introduce -V for verbatim import
When given a pool name via -e, zdb would attempt an import. If it failed, then it would attempt a verbatim import. This behavior is not always desirable so a -V switch is added to zdb to control the behavior. When specified, a verbatim import is done. Otherwise, the behavior is as it was previously, except no verbatim import is done on failure. Signed-off-by: Richard Yao <ryao@gentoo.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #2372
This commit is contained in:
parent
2fbc542ebd
commit
a5778ea242
@ -3227,8 +3227,10 @@ main(int argc, char **argv)
|
|||||||
char *target;
|
char *target;
|
||||||
nvlist_t *policy = NULL;
|
nvlist_t *policy = NULL;
|
||||||
uint64_t max_txg = UINT64_MAX;
|
uint64_t max_txg = UINT64_MAX;
|
||||||
|
int flags = ZFS_IMPORT_MISSING_LOG;
|
||||||
int rewind = ZPOOL_NEVER_REWIND;
|
int rewind = ZPOOL_NEVER_REWIND;
|
||||||
char *spa_config_path_env;
|
char *spa_config_path_env;
|
||||||
|
const char *opts = "bcdhilmM:suCDRSAFLVXevp:t:U:P";
|
||||||
|
|
||||||
(void) setrlimit(RLIMIT_NOFILE, &rl);
|
(void) setrlimit(RLIMIT_NOFILE, &rl);
|
||||||
(void) enable_extended_FILE_stdio(-1, -1);
|
(void) enable_extended_FILE_stdio(-1, -1);
|
||||||
@ -3244,7 +3246,7 @@ main(int argc, char **argv)
|
|||||||
if (spa_config_path_env != NULL)
|
if (spa_config_path_env != NULL)
|
||||||
spa_config_path = spa_config_path_env;
|
spa_config_path = spa_config_path_env;
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "bcdhilmM:suCDRSAFLXevp:t:U:P")) != -1) {
|
while ((c = getopt(argc, argv, opts)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'b':
|
case 'b':
|
||||||
case 'c':
|
case 'c':
|
||||||
@ -3270,6 +3272,9 @@ main(int argc, char **argv)
|
|||||||
case 'P':
|
case 'P':
|
||||||
dump_opt[c]++;
|
dump_opt[c]++;
|
||||||
break;
|
break;
|
||||||
|
case 'V':
|
||||||
|
flags = ZFS_IMPORT_VERBATIM;
|
||||||
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose++;
|
verbose++;
|
||||||
break;
|
break;
|
||||||
@ -3381,11 +3386,7 @@ main(int argc, char **argv)
|
|||||||
fatal("can't open '%s': %s",
|
fatal("can't open '%s': %s",
|
||||||
target, strerror(ENOMEM));
|
target, strerror(ENOMEM));
|
||||||
}
|
}
|
||||||
if ((error = spa_import(name, cfg, NULL,
|
error = spa_import(name, cfg, NULL, flags);
|
||||||
ZFS_IMPORT_MISSING_LOG)) != 0) {
|
|
||||||
error = spa_import(name, cfg, NULL,
|
|
||||||
ZFS_IMPORT_VERBATIM);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
\fBzdb\fR - Display zpool debugging and consistency information
|
\fBzdb\fR - Display zpool debugging and consistency information
|
||||||
|
|
||||||
.SH "SYNOPSIS"
|
.SH "SYNOPSIS"
|
||||||
\fBzdb\fR [-CumdibcsDvhLXFPA] [-e [-p \fIpath\fR...]] [-t \fItxg\fR]
|
\fBzdb\fR [-CumdibcsDvhLVXFPA] [-e [-p \fIpath\fR...]] [-t \fItxg\fR]
|
||||||
[-U \fIcache\fR] [-M \fIinflight I/Os\fR] [\fIpoolname\fR
|
[-U \fIcache\fR] [-M \fIinflight I/Os\fR] [\fIpoolname\fR
|
||||||
[\fIobject\fR ...]]
|
[\fIobject\fR ...]]
|
||||||
|
|
||||||
@ -429,6 +429,17 @@ Attempt \'extreme\' transaction rewind, that is attempt the same recovery as
|
|||||||
\fB-F\fR but read transactions otherwise deemed too old.
|
\fB-F\fR but read transactions otherwise deemed too old.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
|
.sp
|
||||||
|
.ne 2
|
||||||
|
.na
|
||||||
|
\fB-V\fR
|
||||||
|
.ad
|
||||||
|
.sp .6
|
||||||
|
.RS 4n
|
||||||
|
Attempt a verbatim import. This mimics the behavior of the kernel when loading
|
||||||
|
a pool from a cachefile.
|
||||||
|
.RE
|
||||||
|
|
||||||
.P
|
.P
|
||||||
Specifying a display option more than once enables verbosity for only that
|
Specifying a display option more than once enables verbosity for only that
|
||||||
option, with more occurrences enabling more verbosity.
|
option, with more occurrences enabling more verbosity.
|
||||||
|
Loading…
Reference in New Issue
Block a user