From 5c1b45d67cd44a89eed9bde23eea1276ac5e56dd Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Sat, 3 Feb 2018 14:00:02 -0500 Subject: [PATCH] extentwalker: remove wrong constraint check Extents that extend past EOF will have ipos = (file size rounded up to next block) and e.end() = (file size not rounded), which fails this constraint check. The constraint check is wrong. Remove it for now. Signed-off-by: Zygo Blaxell --- lib/extentwalker.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/extentwalker.cc b/lib/extentwalker.cc index 31ecf3f..5a1b91f 100644 --- a/lib/extentwalker.cc +++ b/lib/extentwalker.cc @@ -332,7 +332,9 @@ namespace crucible { THROW_CHECK1(runtime_error, new_vec.size(), !new_vec.empty()); // Allow last extent to extend beyond desired range (e.g. at EOF) - THROW_CHECK2(runtime_error, ipos, new_vec.rbegin()->m_end, ipos <= new_vec.rbegin()->m_end); + // ...but that's not what this does + // THROW_CHECK3(runtime_error, ipos, new_vec.rbegin()->m_end, m_stat.st_size, ipos <= new_vec.rbegin()->m_end); + // If we have the last extent in the file, truncate it to the file size. if (ipos >= m_stat.st_size) { THROW_CHECK2(runtime_error, new_vec.rbegin()->m_begin, m_stat.st_size, m_stat.st_size > new_vec.rbegin()->m_begin);