[thin] store the device id in single_mapping_tree_damage_visitor for error reporting
1. fix the damage type for single_mapping_tree_damage_visitor 2. walk_mapping_tree() now requires the device id 3. update metadata_dumper and thin_ls for the new walk_mapping_tree()
This commit is contained in:
parent
a3eac8d5d8
commit
e8f1bda1a5
@ -193,14 +193,16 @@ namespace {
|
||||
|
||||
class single_mapping_tree_damage_visitor {
|
||||
public:
|
||||
single_mapping_tree_damage_visitor(damage_visitor &v)
|
||||
: v_(v) {
|
||||
single_mapping_tree_damage_visitor(damage_visitor &v,
|
||||
uint64_t dev_id)
|
||||
: v_(v),
|
||||
dev_id_(dev_id) {
|
||||
}
|
||||
|
||||
virtual void visit(btree_path const &path, btree_detail::damage const &d) {
|
||||
switch (path.size()) {
|
||||
case 0:
|
||||
v_.visit(missing_devices(d.desc_, d.lost_keys_));
|
||||
v_.visit(missing_mappings(d.desc_, dev_id_, d.lost_keys_));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -210,6 +212,7 @@ namespace {
|
||||
|
||||
private:
|
||||
damage_visitor &v_;
|
||||
uint64_t dev_id_;
|
||||
};
|
||||
|
||||
}
|
||||
@ -250,19 +253,21 @@ thin_provisioning::check_mapping_tree(mapping_tree const &tree,
|
||||
|
||||
void
|
||||
thin_provisioning::walk_mapping_tree(single_mapping_tree const &tree,
|
||||
uint64_t dev_id,
|
||||
mapping_tree_detail::mapping_visitor &mv,
|
||||
mapping_tree_detail::damage_visitor &dv)
|
||||
{
|
||||
single_mapping_tree_damage_visitor ll_dv(dv);
|
||||
single_mapping_tree_damage_visitor ll_dv(dv, dev_id);
|
||||
btree_visit_values(tree, mv, ll_dv);
|
||||
}
|
||||
|
||||
void
|
||||
thin_provisioning::check_mapping_tree(single_mapping_tree const &tree,
|
||||
uint64_t dev_id,
|
||||
mapping_tree_detail::damage_visitor &visitor)
|
||||
{
|
||||
noop_block_time_visitor mv;
|
||||
walk_mapping_tree(tree, mv, visitor);
|
||||
walk_mapping_tree(tree, dev_id, mv, visitor);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
@ -139,9 +139,11 @@ namespace thin_provisioning {
|
||||
mapping_tree_detail::damage_visitor &visitor);
|
||||
|
||||
void walk_mapping_tree(single_mapping_tree const &tree,
|
||||
uint64_t dev_id,
|
||||
mapping_tree_detail::mapping_visitor &mv,
|
||||
mapping_tree_detail::damage_visitor &dv);
|
||||
void check_mapping_tree(single_mapping_tree const &tree,
|
||||
uint64_t dev_id,
|
||||
mapping_tree_detail::damage_visitor &visitor);
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ namespace {
|
||||
|
||||
try {
|
||||
if (!opts_.skip_mappings_)
|
||||
emit_mappings(tree_root);
|
||||
emit_mappings(dev_id, tree_root);
|
||||
} catch (exception &e) {
|
||||
cerr << e.what();
|
||||
e_->end_device();
|
||||
@ -213,11 +213,11 @@ namespace {
|
||||
}
|
||||
|
||||
private:
|
||||
void emit_mappings(block_address subtree_root) {
|
||||
void emit_mappings(uint64_t dev_id, block_address subtree_root) {
|
||||
mapping_emitter me(e_);
|
||||
single_mapping_tree tree(*md_->tm_, subtree_root,
|
||||
mapping_tree_detail::block_time_ref_counter(md_->data_sm_));
|
||||
walk_mapping_tree(tree, static_cast<mapping_tree_detail::mapping_visitor &>(me), *damage_policy_);
|
||||
walk_mapping_tree(tree, dev_id, static_cast<mapping_tree_detail::mapping_visitor &>(me), *damage_policy_);
|
||||
}
|
||||
|
||||
dump_options const &opts_;
|
||||
@ -274,7 +274,8 @@ thin_provisioning::metadata_dump_subtree(metadata::ptr md, emitter::ptr e, bool
|
||||
mapping_emitter me(e);
|
||||
single_mapping_tree tree(*md->tm_, subtree_root,
|
||||
mapping_tree_detail::block_time_ref_counter(md->data_sm_));
|
||||
walk_mapping_tree(tree, static_cast<mapping_tree_detail::mapping_visitor &>(me),
|
||||
// FIXME: pass the current device id instead of zero
|
||||
walk_mapping_tree(tree, 0, static_cast<mapping_tree_detail::mapping_visitor &>(me),
|
||||
*mapping_damage_policy(repair));
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ namespace {
|
||||
|
||||
mapping_pass1 pass1(mappings);
|
||||
fatal_mapping_damage dv;
|
||||
walk_mapping_tree(dev_mappings, pass1, dv);
|
||||
walk_mapping_tree(dev_mappings, dev_id, pass1, dv);
|
||||
}
|
||||
|
||||
|
||||
@ -264,7 +264,7 @@ namespace {
|
||||
|
||||
mapping_pass2 pass2(mappings);
|
||||
fatal_mapping_damage dv;
|
||||
walk_mapping_tree(dev_mappings, pass2, dv);
|
||||
walk_mapping_tree(dev_mappings, dev_id, pass2, dv);
|
||||
return pass2.get_exclusives();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user