Merge pull request #65 from mingnus/v0.7-devel-fix
Minor fixes for new dev-tools
This commit is contained in:
commit
ef40277d55
@ -37,7 +37,7 @@ namespace persistent_data {
|
|||||||
for (unsigned i = 0; i < nr; i++) {
|
for (unsigned i = 0; i < nr; i++) {
|
||||||
// FIXME: confirm l2 is correct
|
// FIXME: confirm l2 is correct
|
||||||
node_location l2(l);
|
node_location l2(l);
|
||||||
l2.push_key(i);
|
l2.push_key(n.key_at(i));
|
||||||
vc_.visit(l2, n.value_at(i));
|
vc_.visit(l2, n.value_at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -742,7 +742,7 @@ persistent_data::create_disk_sm(transaction_manager &tm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
checked_space_map::ptr
|
checked_space_map::ptr
|
||||||
persistent_data::open_disk_sm(transaction_manager &tm, void *root)
|
persistent_data::open_disk_sm(transaction_manager &tm, void const *root)
|
||||||
{
|
{
|
||||||
sm_root_disk d;
|
sm_root_disk d;
|
||||||
sm_root v;
|
sm_root v;
|
||||||
@ -770,7 +770,7 @@ persistent_data::create_metadata_sm(transaction_manager &tm, block_address nr_bl
|
|||||||
}
|
}
|
||||||
|
|
||||||
checked_space_map::ptr
|
checked_space_map::ptr
|
||||||
persistent_data::open_metadata_sm(transaction_manager &tm, void *root)
|
persistent_data::open_metadata_sm(transaction_manager &tm, void const *root)
|
||||||
{
|
{
|
||||||
sm_root_disk d;
|
sm_root_disk d;
|
||||||
sm_root v;
|
sm_root v;
|
||||||
|
@ -29,13 +29,13 @@ namespace persistent_data {
|
|||||||
create_disk_sm(transaction_manager &tm, block_address nr_blocks);
|
create_disk_sm(transaction_manager &tm, block_address nr_blocks);
|
||||||
|
|
||||||
checked_space_map::ptr
|
checked_space_map::ptr
|
||||||
open_disk_sm(transaction_manager &tm, void *root);
|
open_disk_sm(transaction_manager &tm, void const *root);
|
||||||
|
|
||||||
checked_space_map::ptr
|
checked_space_map::ptr
|
||||||
create_metadata_sm(transaction_manager &tm, block_address nr_blocks);
|
create_metadata_sm(transaction_manager &tm, block_address nr_blocks);
|
||||||
|
|
||||||
checked_space_map::ptr
|
checked_space_map::ptr
|
||||||
open_metadata_sm(transaction_manager &tm, void *root);
|
open_metadata_sm(transaction_manager &tm, void const *root);
|
||||||
|
|
||||||
bcache::validator::ptr bitmap_validator();
|
bcache::validator::ptr bitmap_validator();
|
||||||
|
|
||||||
|
@ -193,14 +193,16 @@ namespace {
|
|||||||
|
|
||||||
class single_mapping_tree_damage_visitor {
|
class single_mapping_tree_damage_visitor {
|
||||||
public:
|
public:
|
||||||
single_mapping_tree_damage_visitor(damage_visitor &v)
|
single_mapping_tree_damage_visitor(damage_visitor &v,
|
||||||
: v_(v) {
|
uint64_t dev_id)
|
||||||
|
: v_(v),
|
||||||
|
dev_id_(dev_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(btree_path const &path, btree_detail::damage const &d) {
|
virtual void visit(btree_path const &path, btree_detail::damage const &d) {
|
||||||
switch (path.size()) {
|
switch (path.size()) {
|
||||||
case 0:
|
case 0:
|
||||||
v_.visit(missing_devices(d.desc_, d.lost_keys_));
|
v_.visit(missing_mappings(d.desc_, dev_id_, d.lost_keys_));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -210,6 +212,7 @@ namespace {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
damage_visitor &v_;
|
damage_visitor &v_;
|
||||||
|
uint64_t dev_id_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -250,19 +253,21 @@ thin_provisioning::check_mapping_tree(mapping_tree const &tree,
|
|||||||
|
|
||||||
void
|
void
|
||||||
thin_provisioning::walk_mapping_tree(single_mapping_tree const &tree,
|
thin_provisioning::walk_mapping_tree(single_mapping_tree const &tree,
|
||||||
|
uint64_t dev_id,
|
||||||
mapping_tree_detail::mapping_visitor &mv,
|
mapping_tree_detail::mapping_visitor &mv,
|
||||||
mapping_tree_detail::damage_visitor &dv)
|
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);
|
btree_visit_values(tree, mv, ll_dv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
thin_provisioning::check_mapping_tree(single_mapping_tree const &tree,
|
thin_provisioning::check_mapping_tree(single_mapping_tree const &tree,
|
||||||
|
uint64_t dev_id,
|
||||||
mapping_tree_detail::damage_visitor &visitor)
|
mapping_tree_detail::damage_visitor &visitor)
|
||||||
{
|
{
|
||||||
noop_block_time_visitor mv;
|
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);
|
mapping_tree_detail::damage_visitor &visitor);
|
||||||
|
|
||||||
void walk_mapping_tree(single_mapping_tree const &tree,
|
void walk_mapping_tree(single_mapping_tree const &tree,
|
||||||
|
uint64_t dev_id,
|
||||||
mapping_tree_detail::mapping_visitor &mv,
|
mapping_tree_detail::mapping_visitor &mv,
|
||||||
mapping_tree_detail::damage_visitor &dv);
|
mapping_tree_detail::damage_visitor &dv);
|
||||||
void check_mapping_tree(single_mapping_tree const &tree,
|
void check_mapping_tree(single_mapping_tree const &tree,
|
||||||
|
uint64_t dev_id,
|
||||||
mapping_tree_detail::damage_visitor &visitor);
|
mapping_tree_detail::damage_visitor &visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,8 +7,9 @@ using namespace thin_provisioning;
|
|||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
void thin_provisioning::count_trees(transaction_manager::ptr tm,
|
namespace {
|
||||||
superblock_detail::superblock &sb,
|
void count_trees(transaction_manager::ptr tm,
|
||||||
|
superblock_detail::superblock const &sb,
|
||||||
block_counter &bc) {
|
block_counter &bc) {
|
||||||
|
|
||||||
// Count the device tree
|
// Count the device tree
|
||||||
@ -26,32 +27,33 @@ void thin_provisioning::count_trees(transaction_manager::ptr tm,
|
|||||||
mapping_tree_detail::block_traits::ref_counter(space_map::ptr()));
|
mapping_tree_detail::block_traits::ref_counter(space_map::ptr()));
|
||||||
count_btree_blocks(mtree, bc, vc);
|
count_btree_blocks(mtree, bc, vc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void thin_provisioning::count_space_maps(transaction_manager::ptr tm,
|
void count_space_maps(transaction_manager::ptr tm,
|
||||||
superblock_detail::superblock &sb,
|
superblock_detail::superblock const &sb,
|
||||||
block_counter &bc) {
|
block_counter &bc) {
|
||||||
// Count the metadata space map (no-throw)
|
// Count the metadata space map (no-throw)
|
||||||
try {
|
try {
|
||||||
persistent_space_map::ptr metadata_sm =
|
persistent_space_map::ptr metadata_sm =
|
||||||
open_metadata_sm(*tm, static_cast<void *>(&sb.metadata_space_map_root_));
|
open_metadata_sm(*tm, static_cast<void const *>(&sb.metadata_space_map_root_));
|
||||||
metadata_sm->count_metadata(bc);
|
metadata_sm->count_metadata(bc);
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
cerr << e.what() << endl;
|
cerr << e.what() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count the data space map (no-throw)
|
// Count the data space map (no-throw)
|
||||||
try {
|
{
|
||||||
persistent_space_map::ptr data_sm =
|
persistent_space_map::ptr data_sm =
|
||||||
open_disk_sm(*tm, static_cast<void *>(&sb.data_space_map_root_));
|
open_disk_sm(*tm, static_cast<void const *>(&sb.data_space_map_root_));
|
||||||
data_sm->count_metadata(bc);
|
data_sm->count_metadata(bc);
|
||||||
} catch (std::exception &e) {
|
}
|
||||||
cerr << e.what() << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
void thin_provisioning::count_metadata(transaction_manager::ptr tm,
|
void thin_provisioning::count_metadata(transaction_manager::ptr tm,
|
||||||
superblock_detail::superblock &sb,
|
superblock_detail::superblock const &sb,
|
||||||
block_counter &bc,
|
block_counter &bc,
|
||||||
bool skip_metadata_snap) {
|
bool skip_metadata_snap) {
|
||||||
// Count the superblock
|
// Count the superblock
|
||||||
|
@ -7,14 +7,8 @@
|
|||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
namespace thin_provisioning {
|
namespace thin_provisioning {
|
||||||
void count_trees(transaction_manager::ptr tm,
|
|
||||||
superblock_detail::superblock &sb,
|
|
||||||
block_counter &bc);
|
|
||||||
void count_space_maps(transaction_manager::ptr tm,
|
|
||||||
superblock_detail::superblock &sb,
|
|
||||||
block_counter &bc);
|
|
||||||
void count_metadata(transaction_manager::ptr tm,
|
void count_metadata(transaction_manager::ptr tm,
|
||||||
superblock_detail::superblock &sb,
|
superblock_detail::superblock const &sb,
|
||||||
block_counter &bc,
|
block_counter &bc,
|
||||||
bool skip_metadata_snap = false);
|
bool skip_metadata_snap = false);
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ namespace {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (!opts_.skip_mappings_)
|
if (!opts_.skip_mappings_)
|
||||||
emit_mappings(tree_root);
|
emit_mappings(dev_id, tree_root);
|
||||||
} catch (exception &e) {
|
} catch (exception &e) {
|
||||||
cerr << e.what();
|
cerr << e.what();
|
||||||
e_->end_device();
|
e_->end_device();
|
||||||
@ -213,11 +213,11 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void emit_mappings(block_address subtree_root) {
|
void emit_mappings(uint64_t dev_id, block_address subtree_root) {
|
||||||
mapping_emitter me(e_);
|
mapping_emitter me(e_);
|
||||||
single_mapping_tree tree(*md_->tm_, subtree_root,
|
single_mapping_tree tree(*md_->tm_, subtree_root,
|
||||||
mapping_tree_detail::block_time_ref_counter(md_->data_sm_));
|
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_;
|
dump_options const &opts_;
|
||||||
@ -274,7 +274,8 @@ thin_provisioning::metadata_dump_subtree(metadata::ptr md, emitter::ptr e, bool
|
|||||||
mapping_emitter me(e);
|
mapping_emitter me(e);
|
||||||
single_mapping_tree tree(*md->tm_, subtree_root,
|
single_mapping_tree tree(*md->tm_, subtree_root,
|
||||||
mapping_tree_detail::block_time_ref_counter(md->data_sm_));
|
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));
|
*mapping_damage_policy(repair));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ namespace {
|
|||||||
|
|
||||||
mapping_pass1 pass1(mappings);
|
mapping_pass1 pass1(mappings);
|
||||||
fatal_mapping_damage dv;
|
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);
|
mapping_pass2 pass2(mappings);
|
||||||
fatal_mapping_damage dv;
|
fatal_mapping_damage dv;
|
||||||
walk_mapping_tree(dev_mappings, pass2, dv);
|
walk_mapping_tree(dev_mappings, dev_id, pass2, dv);
|
||||||
return pass2.get_exclusives();
|
return pass2.get_exclusives();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user