[thin_dump] --skip-mappings

This commit is contained in:
Joe Thornber 2016-03-22 15:01:37 +00:00
parent ad4fd30a27
commit 4370f048c0
4 changed files with 14 additions and 3 deletions

View File

@ -39,10 +39,13 @@ the thin provisioning device-mapper target, else try the one at block#.
See the thin provisioning target documentation on how to create or release
a metadata snapshot and retrieve the block number from the kernel.
.IP "\fN\-\-dev\-id\fP <dev-id>".
.IP "\fB\-\-dev\-id\fP <dev-id>".
Dump the specified device. This option may be specified multiple
times to select more than one thin device.
.IP "\fB\-\-skip\-mappings".
Do not dump the mappings.
.IP "\fB\-h, \-\-help\fP".
Print help and exit.

View File

@ -195,7 +195,8 @@ namespace {
d.snapshotted_time_);
try {
emit_mappings(tree_root);
if (!opts_.skip_mappings_)
emit_mappings(tree_root);
} catch (exception &e) {
cerr << e.what();
e_->end_device();

View File

@ -31,7 +31,8 @@ namespace thin_provisioning {
class dump_options {
public:
dump_options()
: repair_(false) {
: repair_(false),
skip_mappings_(false) {
}
bool selected_dev(uint64_t dev_id) const {
@ -46,6 +47,7 @@ namespace thin_provisioning {
}
bool repair_;
bool skip_mappings_;
using dev_set = std::set<uint64_t>;
using maybe_dev_set = boost::optional<dev_set>;

View File

@ -128,6 +128,7 @@ thin_dump_cmd::run(int argc, char **argv)
{ "format", required_argument, NULL, 'f' },
{ "repair", no_argument, NULL, 'r'},
{ "dev-id", required_argument, NULL, 1 },
{ "skip-mappings", no_argument, NULL, 2 },
{ "version", no_argument, NULL, 'V'},
{ NULL, no_argument, NULL, 0 }
};
@ -175,6 +176,10 @@ thin_dump_cmd::run(int argc, char **argv)
flags.opts.select_dev(dev_id);
break;
case 2:
flags.opts.skip_mappings_ = true;
break;
case 'V':
cout << THIN_PROVISIONING_TOOLS_VERSION << endl;
return 0;