From b777a77023492c542bca1ed176c3a38726ca55cd Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Thu, 4 Apr 2019 14:38:46 +0100 Subject: [PATCH] [thin-provisioning] pass the tm by reference to the metadata object --- thin-provisioning/mapping_tree.cc | 2 +- thin-provisioning/mapping_tree.h | 4 ++-- thin-provisioning/metadata.cc | 6 +++--- thin-provisioning/thin_check.cc | 2 +- thin-provisioning/thin_ll_dump.cc | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/thin-provisioning/mapping_tree.cc b/thin-provisioning/mapping_tree.cc index c1a9358..5b69fe9 100644 --- a/thin-provisioning/mapping_tree.cc +++ b/thin-provisioning/mapping_tree.cc @@ -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) { } diff --git a/thin-provisioning/mapping_tree.h b/thin-provisioning/mapping_tree.h index 4e6adda..ce88ba2 100644 --- a/thin-provisioning/mapping_tree.h +++ b/thin-provisioning/mapping_tree.h @@ -45,13 +45,13 @@ namespace thin_provisioning { class mtree_ref_counter { public: - mtree_ref_counter(transaction_manager::ptr tm); + mtree_ref_counter(transaction_manager &tm); void inc(block_address b); void dec(block_address b); private: - transaction_manager::ptr tm_; + transaction_manager &tm_; }; // This value type is itself a tree containing mappings. diff --git a/thin-provisioning/metadata.cc b/thin-provisioning/metadata.cc index 67c08ae..7f91b51 100644 --- a/thin-provisioning/metadata.cc +++ b/thin-provisioning/metadata.cc @@ -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_, device_tree_detail::device_details_traits::ref_counter())); 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_, mapping_tree_detail::block_time_ref_counter(data_sm_))); break; @@ -89,7 +89,7 @@ metadata::metadata(block_manager<>::ptr bm, open_type ot, mappings_ = mapping_tree::ptr(new mapping_tree(*tm_, mapping_tree_detail::block_time_ref_counter(data_sm_))); 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_)); sb_.magic_ = SUPERBLOCK_MAGIC; @@ -164,7 +164,7 @@ void metadata::open_btrees() details_ = device_tree::ptr(new device_tree(*tm_, sb_.device_details_root_, device_tree_detail::device_details_traits::ref_counter())); 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_, mapping_tree_detail::block_time_ref_counter(data_sm_))); } diff --git a/thin-provisioning/thin_check.cc b/thin-provisioning/thin_check.cc index c553cb7..6373603 100644 --- a/thin-provisioning/thin_check.cc +++ b/thin-provisioning/thin_check.cc @@ -253,7 +253,7 @@ namespace { { nested_output::nest _ = out.push(); 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); } diff --git a/thin-provisioning/thin_ll_dump.cc b/thin-provisioning/thin_ll_dump.cc index bc11cf2..2c63b37 100644 --- a/thin-provisioning/thin_ll_dump.cc +++ b/thin-provisioning/thin_ll_dump.cc @@ -215,7 +215,7 @@ namespace { // output the top-level data mapping tree ll_mapping_tree_emitter ll_mte(tm->get_bm(), out); 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; btree_visit_values(dtree, ll_mte, noop_dv);