[thin-provisioning] pass the tm by reference to the metadata object

This commit is contained in:
Joe Thornber 2019-04-04 14:38:46 +01:00
parent aace49cdd6
commit b777a77023
5 changed files with 8 additions and 8 deletions

View File

@ -64,7 +64,7 @@ namespace thin_provisioning {
//-------------------------------- //--------------------------------
mtree_ref_counter::mtree_ref_counter(transaction_manager::ptr tm) mtree_ref_counter::mtree_ref_counter(transaction_manager &tm)
: tm_(tm) : tm_(tm)
{ {
} }

View File

@ -45,13 +45,13 @@ namespace thin_provisioning {
class mtree_ref_counter { class mtree_ref_counter {
public: public:
mtree_ref_counter(transaction_manager::ptr tm); mtree_ref_counter(transaction_manager &tm);
void inc(block_address b); void inc(block_address b);
void dec(block_address b); void dec(block_address b);
private: private:
transaction_manager::ptr tm_; transaction_manager &tm_;
}; };
// This value type is itself a tree containing mappings. // This value type is itself a tree containing mappings.

View File

@ -71,7 +71,7 @@ metadata::metadata(block_manager<>::ptr bm, open_type ot,
details_ = device_tree::ptr(new device_tree(*tm_, sb_.device_details_root_, details_ = device_tree::ptr(new device_tree(*tm_, sb_.device_details_root_,
device_tree_detail::device_details_traits::ref_counter())); device_tree_detail::device_details_traits::ref_counter()));
mappings_top_level_ = dev_tree::ptr(new dev_tree(*tm_, sb_.data_mapping_root_, mappings_top_level_ = dev_tree::ptr(new dev_tree(*tm_, sb_.data_mapping_root_,
mapping_tree_detail::mtree_ref_counter(tm_))); mapping_tree_detail::mtree_ref_counter(*tm_)));
mappings_ = mapping_tree::ptr(new mapping_tree(*tm_, sb_.data_mapping_root_, mappings_ = mapping_tree::ptr(new mapping_tree(*tm_, sb_.data_mapping_root_,
mapping_tree_detail::block_time_ref_counter(data_sm_))); mapping_tree_detail::block_time_ref_counter(data_sm_)));
break; break;
@ -89,7 +89,7 @@ metadata::metadata(block_manager<>::ptr bm, open_type ot,
mappings_ = mapping_tree::ptr(new mapping_tree(*tm_, mappings_ = mapping_tree::ptr(new mapping_tree(*tm_,
mapping_tree_detail::block_time_ref_counter(data_sm_))); mapping_tree_detail::block_time_ref_counter(data_sm_)));
mappings_top_level_ = dev_tree::ptr(new dev_tree(*tm_, mappings_->get_root(), mappings_top_level_ = dev_tree::ptr(new dev_tree(*tm_, mappings_->get_root(),
mapping_tree_detail::mtree_ref_counter(tm_))); mapping_tree_detail::mtree_ref_counter(*tm_)));
::memset(&sb_, 0, sizeof(sb_)); ::memset(&sb_, 0, sizeof(sb_));
sb_.magic_ = SUPERBLOCK_MAGIC; sb_.magic_ = SUPERBLOCK_MAGIC;
@ -164,7 +164,7 @@ void metadata::open_btrees()
details_ = device_tree::ptr(new device_tree(*tm_, sb_.device_details_root_, details_ = device_tree::ptr(new device_tree(*tm_, sb_.device_details_root_,
device_tree_detail::device_details_traits::ref_counter())); device_tree_detail::device_details_traits::ref_counter()));
mappings_top_level_ = dev_tree::ptr(new dev_tree(*tm_, sb_.data_mapping_root_, mappings_top_level_ = dev_tree::ptr(new dev_tree(*tm_, sb_.data_mapping_root_,
mapping_tree_detail::mtree_ref_counter(tm_))); mapping_tree_detail::mtree_ref_counter(*tm_)));
mappings_ = mapping_tree::ptr(new mapping_tree(*tm_, sb_.data_mapping_root_, mappings_ = mapping_tree::ptr(new mapping_tree(*tm_, sb_.data_mapping_root_,
mapping_tree_detail::block_time_ref_counter(data_sm_))); mapping_tree_detail::block_time_ref_counter(data_sm_)));
} }

View File

@ -253,7 +253,7 @@ namespace {
{ {
nested_output::nest _ = out.push(); nested_output::nest _ = out.push();
dev_tree dtree(*tm, mapping_root(sb, fs), dev_tree dtree(*tm, mapping_root(sb, fs),
mapping_tree_detail::mtree_traits::ref_counter(tm)); mapping_tree_detail::mtree_traits::ref_counter(*tm));
check_mapping_tree(dtree, mapping_rep); check_mapping_tree(dtree, mapping_rep);
} }

View File

@ -215,7 +215,7 @@ namespace {
// output the top-level data mapping tree // output the top-level data mapping tree
ll_mapping_tree_emitter ll_mte(tm->get_bm(), out); ll_mapping_tree_emitter ll_mte(tm->get_bm(), out);
dev_tree dtree(*tm, sb.data_mapping_root_, dev_tree dtree(*tm, sb.data_mapping_root_,
mapping_tree_detail::mtree_traits::ref_counter(tm)); mapping_tree_detail::mtree_traits::ref_counter(*tm));
noop_damage_visitor noop_dv; noop_damage_visitor noop_dv;
btree_visit_values(dtree, ll_mte, noop_dv); btree_visit_values(dtree, ll_mte, noop_dv);