Loading include/global/arithmetic/arithmetic.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -125,7 +125,7 @@ block_overrun(const uint64_t offset, const size_t block_size) { * @returns the distance in bytes between the right-side boundary of @offset */ constexpr size_t chnk_rpad(const uint64_t offset, const size_t block_size) { block_underrun(const uint64_t offset, const size_t block_size) { // This check is automatically removed in release builds assert(is_power_of_2(block_size)); return align_right(offset, block_size) - offset; Loading src/client/rpc/forward_data.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ forward_write(const string& path, const void* buf, const bool append_flag, // receiver of last chunk must subtract if(target == chnk_end_target) { total_chunk_size -= chnk_rpad(offset + write_size, total_chunk_size -= block_underrun(offset + write_size, gkfs::config::rpc::chunksize); } Loading Loading @@ -310,8 +310,8 @@ forward_read(const string& path, void* buf, const off64_t offset, // receiver of last chunk must subtract if(target == chnk_end_target) { total_chunk_size -= chnk_rpad(offset + read_size, gkfs::config::rpc::chunksize); total_chunk_size -= block_underrun(offset + read_size, gkfs::config::rpc::chunksize); } auto endp = CTX->hosts().at(target); Loading tests/unit/test_utils_arithmetic.cpp +9 −6 Original line number Diff line number Diff line Loading @@ -304,7 +304,7 @@ SCENARIO(" overrun distance can be computed correctly ", } SCENARIO(" underrun distance can be computed correctly ", "[utils][numeric][chnk_rpad]") { "[utils][numeric][block_underrun]") { GIVEN(" a block size ") { Loading @@ -320,7 +320,8 @@ SCENARIO(" underrun distance can be computed correctly ", CAPTURE(offset, block_size); THEN(" the computed underrun distance equals block_size ") { const uint64_t underrun = chnk_rpad(offset, block_size); const uint64_t underrun = block_underrun(offset, block_size); const uint64_t expected_underrun = block_size; REQUIRE(underrun == expected_underrun); } Loading @@ -334,7 +335,8 @@ SCENARIO(" underrun distance can be computed correctly ", CAPTURE(offset, block_size); THEN(" the computed underrun distance equals offset ") { const uint64_t underrun = chnk_rpad(offset, block_size); const uint64_t underrun = block_underrun(offset, block_size); const uint64_t expected_underrun = block_size - offset; REQUIRE(underrun == expected_underrun); } Loading @@ -347,7 +349,8 @@ SCENARIO(" underrun distance can be computed correctly ", CAPTURE(offset, block_size); THEN(" the computed underrun distance equals block_size - 1 ") { const uint64_t underrun = chnk_rpad(offset, block_size); const uint64_t underrun = block_underrun(offset, block_size); const uint64_t expected_underrun = block_size - offset; REQUIRE(underrun == expected_underrun); } Loading @@ -361,7 +364,7 @@ SCENARIO(" underrun distance can be computed correctly ", CAPTURE(offset, block_size); THEN(" the computed underrun distance equals block_size ") { const uint64_t underrun = chnk_rpad(offset, block_size); const uint64_t underrun = block_underrun(offset, block_size); const uint64_t expected_underrun = block_size; REQUIRE(underrun == expected_underrun); } Loading @@ -376,7 +379,7 @@ SCENARIO(" underrun distance can be computed correctly ", THEN(" the computed underrun distance equals the difference between " "offset and its closest block's right boundary ") { const uint64_t underrun = chnk_rpad(offset, block_size); const uint64_t underrun = block_underrun(offset, block_size); const uint64_t expected_underrun = static_cast<uint64_t>(offset / block_size + 1) * block_size - Loading Loading
include/global/arithmetic/arithmetic.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -125,7 +125,7 @@ block_overrun(const uint64_t offset, const size_t block_size) { * @returns the distance in bytes between the right-side boundary of @offset */ constexpr size_t chnk_rpad(const uint64_t offset, const size_t block_size) { block_underrun(const uint64_t offset, const size_t block_size) { // This check is automatically removed in release builds assert(is_power_of_2(block_size)); return align_right(offset, block_size) - offset; Loading
src/client/rpc/forward_data.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ forward_write(const string& path, const void* buf, const bool append_flag, // receiver of last chunk must subtract if(target == chnk_end_target) { total_chunk_size -= chnk_rpad(offset + write_size, total_chunk_size -= block_underrun(offset + write_size, gkfs::config::rpc::chunksize); } Loading Loading @@ -310,8 +310,8 @@ forward_read(const string& path, void* buf, const off64_t offset, // receiver of last chunk must subtract if(target == chnk_end_target) { total_chunk_size -= chnk_rpad(offset + read_size, gkfs::config::rpc::chunksize); total_chunk_size -= block_underrun(offset + read_size, gkfs::config::rpc::chunksize); } auto endp = CTX->hosts().at(target); Loading
tests/unit/test_utils_arithmetic.cpp +9 −6 Original line number Diff line number Diff line Loading @@ -304,7 +304,7 @@ SCENARIO(" overrun distance can be computed correctly ", } SCENARIO(" underrun distance can be computed correctly ", "[utils][numeric][chnk_rpad]") { "[utils][numeric][block_underrun]") { GIVEN(" a block size ") { Loading @@ -320,7 +320,8 @@ SCENARIO(" underrun distance can be computed correctly ", CAPTURE(offset, block_size); THEN(" the computed underrun distance equals block_size ") { const uint64_t underrun = chnk_rpad(offset, block_size); const uint64_t underrun = block_underrun(offset, block_size); const uint64_t expected_underrun = block_size; REQUIRE(underrun == expected_underrun); } Loading @@ -334,7 +335,8 @@ SCENARIO(" underrun distance can be computed correctly ", CAPTURE(offset, block_size); THEN(" the computed underrun distance equals offset ") { const uint64_t underrun = chnk_rpad(offset, block_size); const uint64_t underrun = block_underrun(offset, block_size); const uint64_t expected_underrun = block_size - offset; REQUIRE(underrun == expected_underrun); } Loading @@ -347,7 +349,8 @@ SCENARIO(" underrun distance can be computed correctly ", CAPTURE(offset, block_size); THEN(" the computed underrun distance equals block_size - 1 ") { const uint64_t underrun = chnk_rpad(offset, block_size); const uint64_t underrun = block_underrun(offset, block_size); const uint64_t expected_underrun = block_size - offset; REQUIRE(underrun == expected_underrun); } Loading @@ -361,7 +364,7 @@ SCENARIO(" underrun distance can be computed correctly ", CAPTURE(offset, block_size); THEN(" the computed underrun distance equals block_size ") { const uint64_t underrun = chnk_rpad(offset, block_size); const uint64_t underrun = block_underrun(offset, block_size); const uint64_t expected_underrun = block_size; REQUIRE(underrun == expected_underrun); } Loading @@ -376,7 +379,7 @@ SCENARIO(" underrun distance can be computed correctly ", THEN(" the computed underrun distance equals the difference between " "offset and its closest block's right boundary ") { const uint64_t underrun = chnk_rpad(offset, block_size); const uint64_t underrun = block_underrun(offset, block_size); const uint64_t expected_underrun = static_cast<uint64_t>(offset / block_size + 1) * block_size - Loading