Merge remote-tracking branch 'remotes/github-m-h-tsai/v0.6.2-repairtool' into 2016-02-29-mingus-merge

Conflicts:
	Makefile.in
	VERSION
	thin-provisioning/commands.cc
	thin-provisioning/commands.h
	thin-provisioning/thin_delta.cc
This commit is contained in:
Joe Thornber
2016-02-29 10:29:28 +00:00
32 changed files with 1592 additions and 42 deletions

View File

@@ -44,6 +44,8 @@ namespace {
virtual void begin_superblock(std::string const &uuid,
uint64_t time,
uint64_t trans_id,
boost::optional<uint32_t> flags,
boost::optional<uint32_t> version,
uint32_t data_block_size,
uint64_t nr_data_blocks,
boost::optional<uint64_t> metadata_snap) {
@@ -54,6 +56,8 @@ namespace {
memcpy(&sb.uuid_, uuid.c_str(), std::min(sizeof(sb.uuid_), uuid.length()));
sb.time_ = time;
sb.trans_id_ = trans_id;
sb.flags_ = flags ? *flags : 0;
sb.version_ = version ? *version : 1;
sb.data_block_size_ = data_block_size;
sb.metadata_snap_ = metadata_snap ? *metadata_snap : 0;
md_->data_sm_->extend(nr_data_blocks);
@@ -78,10 +82,11 @@ namespace {
if (device_exists(dev))
throw std::runtime_error("Device already exists");
// Add entry to the details tree
uint64_t key[1] = {dev};
device_tree_detail::device_details details = {mapped_blocks, trans_id, (uint32_t)creation_time, (uint32_t)snap_time};
md_->details_->insert(key, details);
// Store the entry of the details tree
current_device_details_.mapped_blocks_ = 0;
current_device_details_.transaction_id_ = trans_id;
current_device_details_.creation_time_ = (uint32_t)creation_time;
current_device_details_.snapshotted_time_ = (uint32_t)snap_time;
current_mapping_ = empty_mapping_->clone();
current_device_ = boost::optional<uint32_t>(dev);
@@ -90,6 +95,9 @@ namespace {
virtual void end_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_->set_root(md_->mappings_top_level_->get_root()); // FIXME: ugly
@@ -130,6 +138,8 @@ namespace {
bt.time_ = time;
current_mapping_->insert(key, bt);
md_->data_sm_->inc(data_block);
current_device_details_.mapped_blocks_ += 1;
}
private:
@@ -149,6 +159,7 @@ namespace {
bool in_superblock_;
block_address nr_data_blocks_;
boost::optional<uint32_t> current_device_;
device_tree_detail::device_details current_device_details_;
single_mapping_tree::ptr current_mapping_;
single_mapping_tree::ptr empty_mapping_;
};