[restore_emitter] Recount device_details::mapped_blocks_
This commit is contained in:
parent
d28e64aff0
commit
992ad02ce9
@ -82,10 +82,11 @@ namespace {
|
|||||||
if (device_exists(dev))
|
if (device_exists(dev))
|
||||||
throw std::runtime_error("Device already exists");
|
throw std::runtime_error("Device already exists");
|
||||||
|
|
||||||
// Add entry to the details tree
|
// Store the entry of the details tree
|
||||||
uint64_t key[1] = {dev};
|
current_device_details_.mapped_blocks_ = 0;
|
||||||
device_tree_detail::device_details details = {mapped_blocks, trans_id, (uint32_t)creation_time, (uint32_t)snap_time};
|
current_device_details_.transaction_id_ = trans_id;
|
||||||
md_->details_->insert(key, details);
|
current_device_details_.creation_time_ = (uint32_t)creation_time;
|
||||||
|
current_device_details_.snapshotted_time_ = (uint32_t)snap_time;
|
||||||
|
|
||||||
current_mapping_ = empty_mapping_->clone();
|
current_mapping_ = empty_mapping_->clone();
|
||||||
current_device_ = boost::optional<uint32_t>(dev);
|
current_device_ = boost::optional<uint32_t>(dev);
|
||||||
@ -94,6 +95,9 @@ namespace {
|
|||||||
virtual void end_device() {
|
virtual void end_device() {
|
||||||
uint64_t key[1] = {*current_device_};
|
uint64_t key[1] = {*current_device_};
|
||||||
|
|
||||||
|
// Add entry to the details tree
|
||||||
|
md_->details_->insert(key, current_device_details_);
|
||||||
|
|
||||||
md_->mappings_top_level_->insert(key, current_mapping_->get_root());
|
md_->mappings_top_level_->insert(key, current_mapping_->get_root());
|
||||||
md_->mappings_->set_root(md_->mappings_top_level_->get_root()); // FIXME: ugly
|
md_->mappings_->set_root(md_->mappings_top_level_->get_root()); // FIXME: ugly
|
||||||
|
|
||||||
@ -134,6 +138,8 @@ namespace {
|
|||||||
bt.time_ = time;
|
bt.time_ = time;
|
||||||
current_mapping_->insert(key, bt);
|
current_mapping_->insert(key, bt);
|
||||||
md_->data_sm_->inc(data_block);
|
md_->data_sm_->inc(data_block);
|
||||||
|
|
||||||
|
current_device_details_.mapped_blocks_ += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -153,6 +159,7 @@ namespace {
|
|||||||
bool in_superblock_;
|
bool in_superblock_;
|
||||||
block_address nr_data_blocks_;
|
block_address nr_data_blocks_;
|
||||||
boost::optional<uint32_t> current_device_;
|
boost::optional<uint32_t> current_device_;
|
||||||
|
device_tree_detail::device_details current_device_details_;
|
||||||
single_mapping_tree::ptr current_mapping_;
|
single_mapping_tree::ptr current_mapping_;
|
||||||
single_mapping_tree::ptr empty_mapping_;
|
single_mapping_tree::ptr empty_mapping_;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user