Merge branch 'master' into v0.7-devel

Conflicts:
	VERSION
	persistent-data/space-maps/disk.cc
	persistent-data/space-maps/disk.h
This commit is contained in:
Joe Thornber
2016-03-22 12:04:51 +00:00
7 changed files with 92 additions and 14 deletions

View File

@@ -185,8 +185,13 @@ namespace {
d.creation_time_,
d.snapshotted_time_);
emit_mappings(tree_root);
try {
emit_mappings(tree_root);
} catch (exception &e) {
cerr << e.what();
e_->end_device();
throw;
}
e_->end_device();
} else if (!repair_) {
@@ -211,6 +216,19 @@ namespace {
bool repair_;
mapping_tree_detail::damage_visitor::ptr damage_policy_;
};
block_address get_nr_blocks(metadata::ptr md) {
if (md->data_sm_)
return md->data_sm_->get_nr_blocks();
else if (md->sb_.blocknr_ == superblock_detail::SUPERBLOCK_LOCATION)
// grab from the root structure of the space map
return get_nr_blocks_in_data_sm(*md->tm_, &md->sb_.data_space_map_root_);
else
// metadata snap, we really don't know
return 0ull;
}
}
//----------------------------------------------------------------
@@ -222,16 +240,12 @@ thin_provisioning::metadata_dump(metadata::ptr md, emitter::ptr e, bool repair)
device_tree_detail::damage_visitor::ptr dd_policy(details_damage_policy(repair));
walk_device_tree(*md->details_, de, *dd_policy);
// metadata snap doesn't have the space maps so we don't know how
// many data blocks there are.
block_address nr_data_blocks = md->data_sm_ ? md->data_sm_->get_nr_blocks() : 0;
e->begin_superblock("", md->sb_.time_,
md->sb_.trans_id_,
md->sb_.flags_,
md->sb_.version_,
md->sb_.data_block_size_,
nr_data_blocks,
get_nr_blocks(md),
boost::optional<block_address>());
{

View File

@@ -109,6 +109,10 @@ namespace {
EXCLUSIVE_SECTORS,
SHARED_SECTORS,
MAPPED_BYTES,
EXCLUSIVE_BYTES,
SHARED_BYTES,
MAPPED,
EXCLUSIVE,
SHARED,
@@ -128,6 +132,10 @@ namespace {
"EXCLUSIVE_SECTORS",
"SHARED_SECTORS",
"MAPPED_BYTES",
"EXCLUSIVE_BYTES",
"SHARED_BYTES",
"MAPPED",
"EXCLUSIVE",
"SHARED",
@@ -298,6 +306,8 @@ namespace {
*it == SHARED_BLOCKS ||
*it == EXCLUSIVE_SECTORS ||
*it == SHARED_SECTORS ||
*it == EXCLUSIVE_BYTES ||
*it == SHARED_BYTES ||
*it == EXCLUSIVE ||
*it == SHARED)
return true;
@@ -375,6 +385,20 @@ namespace {
grid.field((it->second.mapped_blocks_ - exclusive) * block_size);
break;
case MAPPED_BYTES:
grid.field(it->second.mapped_blocks_ * block_size *
disk_unit_multiplier(UNIT_SECTOR));
break;
case EXCLUSIVE_BYTES:
grid.field(exclusive * block_size *
disk_unit_multiplier(UNIT_SECTOR));
break;
case SHARED_BYTES:
grid.field((it->second.mapped_blocks_ - exclusive) * block_size *
disk_unit_multiplier(UNIT_SECTOR));
break;
case MAPPED:
grid.field(

View File

@@ -23,7 +23,8 @@ namespace {
emitter::ptr e = create_restore_emitter(new_md);
block_manager<>::ptr old_bm = open_bm(old_path, block_manager<>::READ_ONLY);
metadata::ptr old_md(new metadata(old_bm, false)); // we don't need to read the space maps
metadata::ptr old_md(new metadata(old_bm, false));
metadata_dump(old_md, e, true);
} catch (std::exception &e) {