[emitter] Preserve the flags and version entries in superblock
This commit is contained in:
parent
b47c02ed8b
commit
7ec47158b5
@ -49,6 +49,8 @@ namespace thin_provisioning {
|
|||||||
virtual void begin_superblock(std::string const &uuid,
|
virtual void begin_superblock(std::string const &uuid,
|
||||||
uint64_t time,
|
uint64_t time,
|
||||||
uint64_t trans_id,
|
uint64_t trans_id,
|
||||||
|
boost::optional<uint32_t> flags,
|
||||||
|
boost::optional<uint32_t> version,
|
||||||
uint32_t data_block_size,
|
uint32_t data_block_size,
|
||||||
uint64_t nr_data_blocks,
|
uint64_t nr_data_blocks,
|
||||||
boost::optional<uint64_t> metadata_snap) = 0;
|
boost::optional<uint64_t> metadata_snap) = 0;
|
||||||
|
@ -43,12 +43,16 @@ namespace {
|
|||||||
void begin_superblock(string const &uuid,
|
void begin_superblock(string const &uuid,
|
||||||
uint64_t time,
|
uint64_t time,
|
||||||
uint64_t trans_id,
|
uint64_t trans_id,
|
||||||
|
boost::optional<uint32_t> flags,
|
||||||
|
boost::optional<uint32_t> version,
|
||||||
uint32_t data_block_size,
|
uint32_t data_block_size,
|
||||||
uint64_t nr_data_blocks,
|
uint64_t nr_data_blocks,
|
||||||
boost::optional<uint64_t> metadata_snap) {
|
boost::optional<uint64_t> metadata_snap) {
|
||||||
out_ << "begin superblock: \"" << uuid << "\""
|
out_ << "begin superblock: \"" << uuid << "\""
|
||||||
<< ", " << time
|
<< ", " << time
|
||||||
<< ", " << trans_id
|
<< ", " << trans_id
|
||||||
|
<< ", " << (flags ? *flags : 0)
|
||||||
|
<< ", " << (version ? *version : 1)
|
||||||
<< ", " << data_block_size
|
<< ", " << data_block_size
|
||||||
<< ", " << nr_data_blocks;
|
<< ", " << nr_data_blocks;
|
||||||
if (metadata_snap)
|
if (metadata_snap)
|
||||||
|
@ -228,6 +228,8 @@ thin_provisioning::metadata_dump(metadata::ptr md, emitter::ptr e, bool repair)
|
|||||||
|
|
||||||
e->begin_superblock("", md->sb_.time_,
|
e->begin_superblock("", md->sb_.time_,
|
||||||
md->sb_.trans_id_,
|
md->sb_.trans_id_,
|
||||||
|
md->sb_.flags_,
|
||||||
|
md->sb_.version_,
|
||||||
md->sb_.data_block_size_,
|
md->sb_.data_block_size_,
|
||||||
nr_data_blocks,
|
nr_data_blocks,
|
||||||
boost::optional<block_address>());
|
boost::optional<block_address>());
|
||||||
|
@ -44,6 +44,8 @@ namespace {
|
|||||||
virtual void begin_superblock(std::string const &uuid,
|
virtual void begin_superblock(std::string const &uuid,
|
||||||
uint64_t time,
|
uint64_t time,
|
||||||
uint64_t trans_id,
|
uint64_t trans_id,
|
||||||
|
boost::optional<uint32_t> flags,
|
||||||
|
boost::optional<uint32_t> version,
|
||||||
uint32_t data_block_size,
|
uint32_t data_block_size,
|
||||||
uint64_t nr_data_blocks,
|
uint64_t nr_data_blocks,
|
||||||
boost::optional<uint64_t> metadata_snap) {
|
boost::optional<uint64_t> metadata_snap) {
|
||||||
@ -54,6 +56,8 @@ namespace {
|
|||||||
memcpy(&sb.uuid_, uuid.c_str(), std::min(sizeof(sb.uuid_), uuid.length()));
|
memcpy(&sb.uuid_, uuid.c_str(), std::min(sizeof(sb.uuid_), uuid.length()));
|
||||||
sb.time_ = time;
|
sb.time_ = time;
|
||||||
sb.trans_id_ = trans_id;
|
sb.trans_id_ = trans_id;
|
||||||
|
sb.flags_ = flags ? *flags : 0;
|
||||||
|
sb.version_ = version ? *version : 1;
|
||||||
sb.data_block_size_ = data_block_size;
|
sb.data_block_size_ = data_block_size;
|
||||||
sb.metadata_snap_ = metadata_snap ? *metadata_snap : 0;
|
sb.metadata_snap_ = metadata_snap ? *metadata_snap : 0;
|
||||||
md_->data_sm_->extend(nr_data_blocks);
|
md_->data_sm_->extend(nr_data_blocks);
|
||||||
|
@ -50,6 +50,8 @@ namespace {
|
|||||||
void begin_superblock(string const &uuid,
|
void begin_superblock(string const &uuid,
|
||||||
uint64_t time,
|
uint64_t time,
|
||||||
uint64_t trans_id,
|
uint64_t trans_id,
|
||||||
|
boost::optional<uint32_t> flags,
|
||||||
|
boost::optional<uint32_t> version,
|
||||||
uint32_t data_block_size,
|
uint32_t data_block_size,
|
||||||
uint64_t nr_data_blocks,
|
uint64_t nr_data_blocks,
|
||||||
boost::optional<uint64_t> metadata_snap) {
|
boost::optional<uint64_t> metadata_snap) {
|
||||||
@ -57,6 +59,8 @@ namespace {
|
|||||||
out_ << "<superblock uuid=\"" << uuid << "\""
|
out_ << "<superblock uuid=\"" << uuid << "\""
|
||||||
<< " time=\"" << time << "\""
|
<< " time=\"" << time << "\""
|
||||||
<< " transaction=\"" << trans_id << "\""
|
<< " transaction=\"" << trans_id << "\""
|
||||||
|
<< " flags=\"" << (flags ? *flags : 0) << "\""
|
||||||
|
<< " version=\"" << (version ? *version : 1) << "\""
|
||||||
<< " data_block_size=\"" << data_block_size << "\""
|
<< " data_block_size=\"" << data_block_size << "\""
|
||||||
<< " nr_data_blocks=\"" << nr_data_blocks;
|
<< " nr_data_blocks=\"" << nr_data_blocks;
|
||||||
|
|
||||||
@ -140,6 +144,8 @@ namespace {
|
|||||||
e->begin_superblock(get_attr<string>(attr, "uuid"),
|
e->begin_superblock(get_attr<string>(attr, "uuid"),
|
||||||
get_attr<uint64_t>(attr, "time"),
|
get_attr<uint64_t>(attr, "time"),
|
||||||
get_attr<uint64_t>(attr, "transaction"),
|
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<uint32_t>(attr, "data_block_size"),
|
||||||
get_attr<uint64_t>(attr, "nr_data_blocks"),
|
get_attr<uint64_t>(attr, "nr_data_blocks"),
|
||||||
get_opt_attr<uint64_t>(attr, "metadata_snap"));
|
get_opt_attr<uint64_t>(attr, "metadata_snap"));
|
||||||
|
Loading…
Reference in New Issue
Block a user