[emitter] Preserve the flags and version entries in superblock

This commit is contained in:
Ming-Hung Tsai 2016-02-27 15:20:02 +08:00
parent b47c02ed8b
commit 7ec47158b5
5 changed files with 18 additions and 0 deletions

View File

@ -49,6 +49,8 @@ namespace thin_provisioning {
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) = 0;

View File

@ -43,12 +43,16 @@ namespace {
void begin_superblock(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) {
out_ << "begin superblock: \"" << uuid << "\""
<< ", " << time
<< ", " << trans_id
<< ", " << (flags ? *flags : 0)
<< ", " << (version ? *version : 1)
<< ", " << data_block_size
<< ", " << nr_data_blocks;
if (metadata_snap)

View File

@ -228,6 +228,8 @@ thin_provisioning::metadata_dump(metadata::ptr md, emitter::ptr e, bool repair)
e->begin_superblock("", md->sb_.time_,
md->sb_.trans_id_,
md->sb_.flags_,
md->sb_.version_,
md->sb_.data_block_size_,
nr_data_blocks,
boost::optional<block_address>());

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);

View File

@ -50,6 +50,8 @@ namespace {
void begin_superblock(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) {
@ -57,6 +59,8 @@ namespace {
out_ << "<superblock uuid=\"" << uuid << "\""
<< " time=\"" << time << "\""
<< " transaction=\"" << trans_id << "\""
<< " flags=\"" << (flags ? *flags : 0) << "\""
<< " version=\"" << (version ? *version : 1) << "\""
<< " data_block_size=\"" << data_block_size << "\""
<< " nr_data_blocks=\"" << nr_data_blocks;
@ -140,6 +144,8 @@ namespace {
e->begin_superblock(get_attr<string>(attr, "uuid"),
get_attr<uint64_t>(attr, "time"),
get_attr<uint64_t>(attr, "transaction"),
get_opt_attr<uint32_t>(attr, "flags"),
get_opt_attr<uint32_t>(attr, "version"),
get_attr<uint32_t>(attr, "data_block_size"),
get_attr<uint64_t>(attr, "nr_data_blocks"),
get_opt_attr<uint64_t>(attr, "metadata_snap"));