From 9f15c5589f8bb851674f97c8bad2ef6ddf637b27 Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Sun, 6 Mar 2016 00:06:27 +0800 Subject: [PATCH 1/3] [thin_scan] Cleanup: move methods before data member declaration --- thin-provisioning/thin_scan.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/thin-provisioning/thin_scan.cc b/thin-provisioning/thin_scan.cc index 94edd1d..725c3b6 100644 --- a/thin-provisioning/thin_scan.cc +++ b/thin-provisioning/thin_scan.cc @@ -129,14 +129,6 @@ namespace { }; struct block_range { - uint64_t begin_; - uint64_t end_; // one-pass-the-end - boost::optional 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() : begin_(0), end_(0), type_(UNKNOWN), ref_count_(-1), @@ -184,6 +176,14 @@ namespace { end_ = std::max(end_, r.end_); return true; } + + uint64_t begin_; + uint64_t end_; // one-pass-the-end + boost::optional 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) { From 8232feb85554b8333ea314f7ec28c9d54d28b136 Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Sun, 6 Mar 2016 01:23:04 +0800 Subject: [PATCH 2/3] [thin_scan] Cleanup: remove unnecessary variables --- thin-provisioning/thin_scan.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/thin-provisioning/thin_scan.cc b/thin-provisioning/thin_scan.cc index 725c3b6..1ed7a6b 100644 --- a/thin-provisioning/thin_scan.cc +++ b/thin-provisioning/thin_scan.cc @@ -152,13 +152,12 @@ namespace { bool is_adjacent_to(block_range const &r) const { block_range const &lhs = begin_ < r.begin_ ? *this : r; block_range const &rhs = begin_ < r.begin_ ? r : *this; - uint64_t common_end = std::min(end_, r.end_); if (size() && r.size() && - rhs.begin_ == common_end && + rhs.begin_ == lhs.end_ && ((!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_))) && type_ == r.type_ && ref_count_ == r.ref_count_ && From 220ece1dc8bc868cd3a143a29448b81c92320b2b Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Sun, 6 Mar 2016 23:21:09 +0800 Subject: [PATCH 3/3] [thin] Cleanup: move methods before data member declaration --- thin-provisioning/device_tree.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thin-provisioning/device_tree.h b/thin-provisioning/device_tree.h index ef32b45..ec0f9f2 100644 --- a/thin-provisioning/device_tree.h +++ b/thin-provisioning/device_tree.h @@ -16,12 +16,12 @@ namespace thin_provisioning { } __attribute__ ((packed)); struct device_details { + device_details(); + uint64_t mapped_blocks_; uint64_t transaction_id_; /* when created */ uint32_t creation_time_; uint32_t snapshotted_time_; - - device_details(); }; struct device_details_traits {