Merge pull request #46 from mingnus/v0.6.2-repairtool

Code cleanup for new dev-tools
This commit is contained in:
Joe Thornber 2016-03-06 16:15:35 +00:00
commit e670a27638
2 changed files with 12 additions and 13 deletions

View File

@ -16,12 +16,12 @@ namespace thin_provisioning {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct device_details { struct device_details {
device_details();
uint64_t mapped_blocks_; uint64_t mapped_blocks_;
uint64_t transaction_id_; /* when created */ uint64_t transaction_id_; /* when created */
uint32_t creation_time_; uint32_t creation_time_;
uint32_t snapshotted_time_; uint32_t snapshotted_time_;
device_details();
}; };
struct device_details_traits { struct device_details_traits {

View File

@ -129,14 +129,6 @@ namespace {
}; };
struct block_range { struct block_range {
uint64_t begin_;
uint64_t end_; // one-pass-the-end
boost::optional<uint64_t> blocknr_begin_;
metadata_block_type type_;
int64_t ref_count_; // ref_count in metadata space map
size_t value_size_; // btree node only
bool is_valid_; // btree node only
block_range() block_range()
: begin_(0), end_(0), : begin_(0), end_(0),
type_(UNKNOWN), ref_count_(-1), type_(UNKNOWN), ref_count_(-1),
@ -160,13 +152,12 @@ namespace {
bool is_adjacent_to(block_range const &r) const { bool is_adjacent_to(block_range const &r) const {
block_range const &lhs = begin_ < r.begin_ ? *this : r; block_range const &lhs = begin_ < r.begin_ ? *this : r;
block_range const &rhs = begin_ < r.begin_ ? r : *this; block_range const &rhs = begin_ < r.begin_ ? r : *this;
uint64_t common_end = std::min(end_, r.end_);
if (size() && r.size() && if (size() && r.size() &&
rhs.begin_ == common_end && rhs.begin_ == lhs.end_ &&
((!blocknr_begin_ && !r.blocknr_begin_) || ((!blocknr_begin_ && !r.blocknr_begin_) ||
(blocknr_begin_ && r.blocknr_begin_ && (blocknr_begin_ && r.blocknr_begin_ &&
*rhs.blocknr_begin_ > *lhs.blocknr_begin_ && *rhs.blocknr_begin_ >= *lhs.blocknr_begin_ &&
(*rhs.blocknr_begin_ - *lhs.blocknr_begin_ == rhs.begin_ - lhs.begin_))) && (*rhs.blocknr_begin_ - *lhs.blocknr_begin_ == rhs.begin_ - lhs.begin_))) &&
type_ == r.type_ && type_ == r.type_ &&
ref_count_ == r.ref_count_ && ref_count_ == r.ref_count_ &&
@ -184,6 +175,14 @@ namespace {
end_ = std::max(end_, r.end_); end_ = std::max(end_, r.end_);
return true; return true;
} }
uint64_t begin_;
uint64_t end_; // one-pass-the-end
boost::optional<uint64_t> blocknr_begin_;
metadata_block_type type_;
int64_t ref_count_; // ref_count in metadata space map
size_t value_size_; // btree node only
bool is_valid_;
}; };
void output_block_range(block_range const &r, std::ostream &out) { void output_block_range(block_range const &r, std::ostream &out) {