mirror of
https://github.com/openzfs/zfs.git
synced 2025-12-19 05:05:52 +01:00
zdb: Add -O option for -r to specify object-id
"zdb -r -O pool/dataset obj-id destination" will copy the file with object-id obj-id to the named destination; without -O it'll still be interpreted as a pathname. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Akash B <akash-b@hpe.com> Signed-off-by: Sean Eric Fagan <sean.fagan@klarasystems.com> Closes #16307
This commit is contained in:
@@ -739,13 +739,14 @@ usage(void)
|
||||
"[-U <cache>]\n\t\t<poolname> [<vdev> [<metaslab> ...]]\n"
|
||||
"\t%s -O [-K <key>] <dataset> <path>\n"
|
||||
"\t%s -r [-K <key>] <dataset> <path> <destination>\n"
|
||||
"\t%s -r [-K <key>] -O <dataset> <object-id> <destination>\n"
|
||||
"\t%s -R [-A] [-e [-V] [-p <path> ...]] [-U <cache>]\n"
|
||||
"\t\t<poolname> <vdev>:<offset>:<size>[:<flags>]\n"
|
||||
"\t%s -E [-A] word0:word1:...:word15\n"
|
||||
"\t%s -S [-AP] [-e [-V] [-p <path> ...]] [-U <cache>] "
|
||||
"<poolname>\n\n",
|
||||
cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname,
|
||||
cmdname, cmdname, cmdname, cmdname, cmdname);
|
||||
cmdname, cmdname, cmdname, cmdname, cmdname, cmdname);
|
||||
|
||||
(void) fprintf(stderr, " Dataset name must include at least one "
|
||||
"separator character '/' or '@'\n");
|
||||
@@ -9956,7 +9957,7 @@ main(int argc, char **argv)
|
||||
* which imports the pool to the namespace if it's
|
||||
* not in the cachefile.
|
||||
*/
|
||||
if (dump_opt['O']) {
|
||||
if (dump_opt['O'] && !dump_opt['r']) {
|
||||
if (argc != 2)
|
||||
usage();
|
||||
dump_opt['v'] = verbose + 3;
|
||||
@@ -9969,7 +9970,11 @@ main(int argc, char **argv)
|
||||
if (argc != 3)
|
||||
usage();
|
||||
dump_opt['v'] = verbose;
|
||||
error = dump_path(argv[0], argv[1], &object);
|
||||
if (dump_opt['O']) {
|
||||
object = strtoull(argv[1], NULL, 0);
|
||||
} else {
|
||||
error = dump_path(argv[0], argv[1], &object);
|
||||
}
|
||||
if (error != 0)
|
||||
fatal("internal error: %s", strerror(error));
|
||||
}
|
||||
|
||||
@@ -84,6 +84,11 @@
|
||||
.Op Fl K Ar key
|
||||
.Ar dataset path destination
|
||||
.Nm
|
||||
.Fl r
|
||||
.Fl O
|
||||
.Op Fl K Ar key
|
||||
.Ar dataset object-id destination
|
||||
.Nm
|
||||
.Fl R
|
||||
.Op Fl A
|
||||
.Op Fl e Oo Fl V Oc Oo Fl p Ar path Oc Ns …
|
||||
@@ -376,6 +381,12 @@ Specified
|
||||
.Ar path
|
||||
must be relative to the root of
|
||||
.Ar dataset .
|
||||
When used with
|
||||
.Fl O ,
|
||||
the
|
||||
.Ar path
|
||||
argument is interpreted as an object identifier,
|
||||
not a path.
|
||||
This option can be combined with
|
||||
.Fl v
|
||||
for increasing verbosity.
|
||||
|
||||
Reference in New Issue
Block a user