From e4d82d04bdb6cb4a38f941abd109f901ff846f2e Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Tue, 17 Jun 2014 16:20:38 +0100 Subject: [PATCH] [thin_delta] Fix bug when detecting right_only mappings --- thin-provisioning/thin_delta.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/thin-provisioning/thin_delta.cc b/thin-provisioning/thin_delta.cc index 7cd96f8..396422b 100644 --- a/thin-provisioning/thin_delta.cc +++ b/thin-provisioning/thin_delta.cc @@ -109,6 +109,13 @@ namespace { uint64_t vbegin_, dbegin_, len_; }; + ostream &operator <<(ostream &out, mapping const &m) { + out << "mapping[vbegin = " << m.vbegin_ + << ", dbegin = " << m.dbegin_ + << ", len = " << m.len_ << "]"; + return out; + } + typedef std::deque mapping_deque; // Builds up an in core rep of the mappings for a device. @@ -409,7 +416,7 @@ namespace { e.left_only(left_mapping.vbegin_, left_mapping.dbegin_, delta); left_mapping.consume(delta); - } else if (left_mapping.vbegin_ > left_mapping.vbegin_) { + } else if (left_mapping.vbegin_ > right_mapping.vbegin_) { uint64_t delta = min(right_mapping.len_, left_mapping.vbegin_ - right_mapping.vbegin_); e.right_only(right_mapping.vbegin_, right_mapping.dbegin_, delta); right_mapping.consume(delta);