[metadata_counter] hide count_trees() and count_space_maps()
This commit is contained in:
parent
9e7af6b677
commit
3439dbfdfc
@ -7,46 +7,50 @@ 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,
|
||||||
block_counter &bc) {
|
superblock_detail::superblock &sb,
|
||||||
|
block_counter &bc) {
|
||||||
|
|
||||||
// Count the device tree
|
// Count the device tree
|
||||||
{
|
{
|
||||||
noop_value_counter<device_tree_detail::device_details> vc;
|
noop_value_counter<device_tree_detail::device_details> vc;
|
||||||
device_tree dtree(*tm, sb.device_details_root_,
|
device_tree dtree(*tm, sb.device_details_root_,
|
||||||
device_tree_detail::device_details_traits::ref_counter());
|
device_tree_detail::device_details_traits::ref_counter());
|
||||||
count_btree_blocks(dtree, bc, vc);
|
count_btree_blocks(dtree, bc, vc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count the mapping tree
|
||||||
|
{
|
||||||
|
noop_value_counter<mapping_tree_detail::block_time> vc;
|
||||||
|
mapping_tree mtree(*tm, sb.data_mapping_root_,
|
||||||
|
mapping_tree_detail::block_traits::ref_counter(space_map::ptr()));
|
||||||
|
count_btree_blocks(mtree, bc, vc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count the mapping tree
|
void count_space_maps(transaction_manager::ptr tm,
|
||||||
{
|
superblock_detail::superblock &sb,
|
||||||
noop_value_counter<mapping_tree_detail::block_time> vc;
|
block_counter &bc) {
|
||||||
mapping_tree mtree(*tm, sb.data_mapping_root_,
|
// Count the metadata space map (no-throw)
|
||||||
mapping_tree_detail::block_traits::ref_counter(space_map::ptr()));
|
try {
|
||||||
count_btree_blocks(mtree, bc, vc);
|
persistent_space_map::ptr metadata_sm =
|
||||||
|
open_metadata_sm(*tm, static_cast<void *>(&sb.metadata_space_map_root_));
|
||||||
|
metadata_sm->count_metadata(bc);
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
cerr << e.what() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count the data space map (no-throw)
|
||||||
|
{
|
||||||
|
persistent_space_map::ptr data_sm =
|
||||||
|
open_disk_sm(*tm, static_cast<void *>(&sb.data_space_map_root_));
|
||||||
|
data_sm->count_metadata(bc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void thin_provisioning::count_space_maps(transaction_manager::ptr tm,
|
//----------------------------------------------------------------
|
||||||
superblock_detail::superblock &sb,
|
|
||||||
block_counter &bc) {
|
|
||||||
// Count the metadata space map (no-throw)
|
|
||||||
try {
|
|
||||||
persistent_space_map::ptr metadata_sm =
|
|
||||||
open_metadata_sm(*tm, static_cast<void *>(&sb.metadata_space_map_root_));
|
|
||||||
metadata_sm->count_metadata(bc);
|
|
||||||
} catch (std::exception &e) {
|
|
||||||
cerr << e.what() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Count the data space map (no-throw)
|
|
||||||
{
|
|
||||||
persistent_space_map::ptr data_sm =
|
|
||||||
open_disk_sm(*tm, static_cast<void *>(&sb.data_space_map_root_));
|
|
||||||
data_sm->count_metadata(bc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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 &sb,
|
||||||
|
@ -7,12 +7,6 @@
|
|||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
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 &sb,
|
||||||
block_counter &bc,
|
block_counter &bc,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user