Fix problem with zdb -d

zdb -d <pool>/<objset ID> does not work when
other command line arguments are included i.e.
zdb -U <cachefile> -d <pool>/<objset ID>
This change fixes the command line parsing
to handle this situation.  Also fix issue
where zdb -r <dataset> <file> does not handle
the root <dataset> of the pool. Introduce -N
option to force <objset ID> to be interpreted
as a numeric objsetID.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Closes #12845
Closes #12944
This commit is contained in:
Paul Zuchowski
2022-01-20 12:28:55 -05:00
committed by GitHub
parent e1c720de7d
commit 5a4d282f55
4 changed files with 146 additions and 35 deletions
+22 -1
View File
@@ -23,7 +23,7 @@
.Nd display ZFS storage pool debugging and consistency information
.Sh SYNOPSIS
.Nm
.Op Fl AbcdDFGhikLMPsvXYy
.Op Fl AbcdDFGhikLMNPsvXYy
.Op Fl e Oo Fl V Oc Oo Fl p Ar path Oc Ns …
.Op Fl I Ar inflight I/Os
.Oo Fl o Ar var Ns = Ns Ar value Oc Ns …
@@ -137,6 +137,14 @@ also display the configuration that would be used were the pool to be imported.
Display information about datasets.
Specified once, displays basic dataset information: ID, create transaction,
size, and object count.
See
.Fl N
for determining if
.Op Ar poolname Ns Op / Ns Ar dataset | objset ID
is to use the specified
.Op Ar dataset | objset ID
as a string (dataset name) or a number (objset ID) when
datasets have numeric names.
.Pp
If specified multiple times provides greater and greater verbosity.
.Pp
@@ -271,6 +279,19 @@ and free space histogram, as well as overall pool fragmentation and histogram.
.It Fl MM
"Special" vdevs are added to -M's normal output.
.It Fl O , -object-lookups Ns = Ns Ar dataset path
Also display information about the maximum contiguous free space and the
percentage of free space in each space map.
.It Fl MMM
Display every spacemap record.
.It Fl N
Same as
.Fl d
but force zdb to interpret the
.Op Ar dataset | objset ID
in
.Op Ar poolname Ns Op / Ns Ar dataset | objset ID
as a numeric objset ID.
.It Fl O Ar dataset path
Look up the specified
.Ar path
inside of the