Introduce mapping_tree.h

This commit is contained in:
Joe Thornber
2013-05-20 17:37:46 +01:00
parent 35880f3038
commit 8f2ab2d676
7 changed files with 140 additions and 113 deletions

View File

@@ -56,7 +56,7 @@ void
thin::insert(block_address thin_block, block_address data_block)
{
uint64_t key[2] = {dev_, thin_block};
block_time bt;
mapping_tree_detail::block_time bt;
bt.block_ = data_block;
bt.time_ = 0; // FIXME: use current time.
return pool_->md_->mappings_->insert(key, bt);
@@ -124,7 +124,8 @@ thin_pool::create_thin(thin_dev_t dev)
if (device_exists(dev))
throw std::runtime_error("Device already exists");
single_mapping_tree::ptr new_tree(new single_mapping_tree(md_->tm_, block_time_ref_counter(md_->data_sm_)));
single_mapping_tree::ptr new_tree(new single_mapping_tree(md_->tm_,
mapping_tree_detail::block_time_ref_counter(md_->data_sm_)));
md_->mappings_top_level_->insert(key, new_tree->get_root());
md_->mappings_->set_root(md_->mappings_top_level_->get_root()); // FIXME: ugly
@@ -142,7 +143,7 @@ thin_pool::create_snap(thin_dev_t dev, thin_dev_t origin)
throw std::runtime_error("unknown origin");
single_mapping_tree otree(md_->tm_, *mtree_root,
block_time_ref_counter(md_->data_sm_));
mapping_tree_detail::block_time_ref_counter(md_->data_sm_));
single_mapping_tree::ptr clone(otree.clone());
md_->mappings_top_level_->insert(snap_key, clone->get_root());