Corrupt superblock repair
This commit is contained in:
@@ -84,33 +84,35 @@ namespace {
|
||||
return e;
|
||||
}
|
||||
|
||||
int dump_(string const &path, ostream &out, struct flags &flags) {
|
||||
try {
|
||||
emitter::ptr e = create_emitter(flags.format, out);
|
||||
int dump_(string const &path, ostream &out, struct flags &flags) {
|
||||
try {
|
||||
emitter::ptr inner = create_emitter(flags.format, out);
|
||||
emitter::ptr e = create_override_emitter(inner, flags.opts.overrides_);
|
||||
|
||||
if (flags.repair) {
|
||||
auto bm = open_bm(path, block_manager<>::READ_ONLY, true);
|
||||
metadata_repair(bm, e);
|
||||
} else {
|
||||
metadata::ptr md = open_metadata(path, flags);
|
||||
metadata_dump(md, e, flags.opts);
|
||||
}
|
||||
if (flags.repair) {
|
||||
auto bm = open_bm(path, block_manager<>::READ_ONLY, true);
|
||||
metadata_repair(bm, e, flags.opts.overrides_);
|
||||
} else {
|
||||
metadata::ptr md = open_metadata(path, flags);
|
||||
metadata_dump(md, e, flags.opts);
|
||||
}
|
||||
|
||||
} catch (std::exception &e) {
|
||||
cerr << e.what() << endl;
|
||||
return 1;
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
cerr << e.what() << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dump(string const &path, char const *output, struct flags &flags) {
|
||||
if (output) {
|
||||
ofstream out(output);
|
||||
return dump_(path, out, flags);
|
||||
} else
|
||||
return dump_(path, cout, flags);
|
||||
}
|
||||
|
||||
int dump(string const &path, char const *output, struct flags &flags) {
|
||||
if (output) {
|
||||
ofstream out(output);
|
||||
return dump_(path, out, flags);
|
||||
} else
|
||||
return dump_(path, cout, flags);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
@@ -205,6 +207,18 @@ thin_dump_cmd::run(int argc, char **argv)
|
||||
flags.opts.skip_mappings_ = true;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
flags.opts.overrides_.transaction_id_ = parse_uint64(optarg, "transaction id");
|
||||
break;
|
||||
|
||||
case 4:
|
||||
flags.opts.overrides_.data_block_size_ = static_cast<uint32_t>(parse_uint64(optarg, "data block size"));
|
||||
break;
|
||||
|
||||
case 5:
|
||||
flags.opts.overrides_.nr_data_blocks_ = parse_uint64(optarg, "nr data blocks");
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
cout << THIN_PROVISIONING_TOOLS_VERSION << endl;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user