Loading include/global/arithmetic/arithmetic.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -149,7 +149,7 @@ block_underrun(const uint64_t offset, const size_t block_size) { * @returns the index of the block containing @offset. */ constexpr uint64_t chnk_id_for_offset(const uint64_t offset, const size_t block_size) { block_index(const uint64_t offset, const size_t block_size) { using gkfs::utils::arithmetic::log2; Loading src/client/rpc/forward_data.cpp +9 −9 Original line number Diff line number Diff line Loading @@ -58,8 +58,8 @@ forward_write(const string& path, const void* buf, const bool append_flag, off64_t offset = append_flag ? in_offset : (updated_metadentry_size - write_size); auto chnk_start = chnk_id_for_offset(offset, gkfs::config::rpc::chunksize); auto chnk_end = chnk_id_for_offset((offset + write_size) - 1, auto chnk_start = block_index(offset, gkfs::config::rpc::chunksize); auto chnk_end = block_index((offset + write_size) - 1, gkfs::config::rpc::chunksize); // Collect all chunk ids within count that have the same destination so Loading Loading @@ -235,9 +235,9 @@ forward_read(const string& path, void* buf, const off64_t offset, // Calculate chunkid boundaries and numbers so that daemons know in which // interval to look for chunks auto chnk_start = chnk_id_for_offset(offset, gkfs::config::rpc::chunksize); auto chnk_end = chnk_id_for_offset((offset + read_size - 1), gkfs::config::rpc::chunksize); auto chnk_start = block_index(offset, gkfs::config::rpc::chunksize); auto chnk_end = block_index((offset + read_size - 1), gkfs::config::rpc::chunksize); // Collect all chunk ids within count that have the same destination so // that those are send in one rpc bulk transfer Loading Loading @@ -412,9 +412,9 @@ forward_truncate(const std::string& path, size_t current_size, // Find out which data servers need to delete data chunks in order to // contact only them const unsigned int chunk_start = chnk_id_for_offset(new_size, gkfs::config::rpc::chunksize); const unsigned int chunk_end = chnk_id_for_offset( current_size - new_size - 1, gkfs::config::rpc::chunksize); block_index(new_size, gkfs::config::rpc::chunksize); const unsigned int chunk_end = block_index(current_size - new_size - 1, gkfs::config::rpc::chunksize); std::unordered_set<unsigned int> hosts; for(unsigned int chunk_id = chunk_start; chunk_id <= chunk_end; Loading src/daemon/ops/data.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -53,8 +53,7 @@ ChunkTruncateOperation::truncate_abt(void* _arg) { int err_response = 0; try { // get chunk from where to cut off auto chunk_id_start = chnk_id_for_offset(size, gkfs::config::rpc::chunksize); auto chunk_id_start = block_index(size, gkfs::config::rpc::chunksize); // do not last delete chunk if it is in the middle of a chunk auto left_pad = block_overrun(size, gkfs::config::rpc::chunksize); if(left_pad != 0) { Loading tests/unit/test_utils_arithmetic.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -391,7 +391,7 @@ SCENARIO(" underrun distance can be computed correctly ", } SCENARIO(" chunk IDs can be computed correctly ", "[utils][numeric][chnk_id_for_offset]") { "[utils][numeric][block_index]") { GIVEN(" an offset and a block size ") { Loading @@ -407,7 +407,7 @@ SCENARIO(" chunk IDs can be computed correctly ", CAPTURE(offset, block_size); THEN(" the computed chunk ID equals 0 ") { const uint64_t id = chnk_id_for_offset(offset, block_size); const uint64_t id = block_index(offset, block_size); const uint64_t expected_id = 0; REQUIRE(id == expected_id); } Loading @@ -421,7 +421,7 @@ SCENARIO(" chunk IDs can be computed correctly ", CAPTURE(offset, block_size); THEN(" the computed chunk ID equals 0 ") { const uint64_t id = chnk_id_for_offset(offset, block_size); const uint64_t id = block_index(offset, block_size); const uint64_t expected_id = 0; REQUIRE(id == expected_id); } Loading @@ -434,7 +434,7 @@ SCENARIO(" chunk IDs can be computed correctly ", CAPTURE(offset, block_size); THEN(" the computed chunk ID equals 0 ") { const uint64_t id = chnk_id_for_offset(offset, block_size); const uint64_t id = block_index(offset, block_size); const uint64_t expected_id = 0; REQUIRE(id == expected_id); } Loading @@ -448,7 +448,7 @@ SCENARIO(" chunk IDs can be computed correctly ", CAPTURE(offset, block_size); THEN(" the computed chunk ID equals 1 ") { const uint64_t id = chnk_id_for_offset(offset, block_size); const uint64_t id = block_index(offset, block_size); const uint64_t expected_id = 1; REQUIRE(id == expected_id); } Loading @@ -468,7 +468,7 @@ SCENARIO(" chunk IDs can be computed correctly ", THEN(" the computed chunk ID is equal to dividing the offset by " "the block_size ") { const uint64_t id = chnk_id_for_offset(offset, block_size); const uint64_t id = block_index(offset, block_size); const uint64_t expected_id = offset / block_size; REQUIRE(id == expected_id); } Loading @@ -485,7 +485,7 @@ SCENARIO(" chunk IDs can be computed correctly ", THEN(" the computed chunk ID is equal to dividing the offset by " "the block_size ") { const uint64_t id = chnk_id_for_offset(offset, block_size); const uint64_t id = block_index(offset, block_size); const uint64_t expected_id = offset / block_size; REQUIRE(id == expected_id); } Loading @@ -501,7 +501,7 @@ SCENARIO(" chunk IDs can be computed correctly ", THEN(" the computed chunk ID is equal to dividing the offset by " "the block_size ") { const uint64_t id = chnk_id_for_offset(offset, block_size); const uint64_t id = block_index(offset, block_size); const uint64_t expected_id = offset / block_size; REQUIRE(id == expected_id); } Loading Loading
include/global/arithmetic/arithmetic.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -149,7 +149,7 @@ block_underrun(const uint64_t offset, const size_t block_size) { * @returns the index of the block containing @offset. */ constexpr uint64_t chnk_id_for_offset(const uint64_t offset, const size_t block_size) { block_index(const uint64_t offset, const size_t block_size) { using gkfs::utils::arithmetic::log2; Loading
src/client/rpc/forward_data.cpp +9 −9 Original line number Diff line number Diff line Loading @@ -58,8 +58,8 @@ forward_write(const string& path, const void* buf, const bool append_flag, off64_t offset = append_flag ? in_offset : (updated_metadentry_size - write_size); auto chnk_start = chnk_id_for_offset(offset, gkfs::config::rpc::chunksize); auto chnk_end = chnk_id_for_offset((offset + write_size) - 1, auto chnk_start = block_index(offset, gkfs::config::rpc::chunksize); auto chnk_end = block_index((offset + write_size) - 1, gkfs::config::rpc::chunksize); // Collect all chunk ids within count that have the same destination so Loading Loading @@ -235,9 +235,9 @@ forward_read(const string& path, void* buf, const off64_t offset, // Calculate chunkid boundaries and numbers so that daemons know in which // interval to look for chunks auto chnk_start = chnk_id_for_offset(offset, gkfs::config::rpc::chunksize); auto chnk_end = chnk_id_for_offset((offset + read_size - 1), gkfs::config::rpc::chunksize); auto chnk_start = block_index(offset, gkfs::config::rpc::chunksize); auto chnk_end = block_index((offset + read_size - 1), gkfs::config::rpc::chunksize); // Collect all chunk ids within count that have the same destination so // that those are send in one rpc bulk transfer Loading Loading @@ -412,9 +412,9 @@ forward_truncate(const std::string& path, size_t current_size, // Find out which data servers need to delete data chunks in order to // contact only them const unsigned int chunk_start = chnk_id_for_offset(new_size, gkfs::config::rpc::chunksize); const unsigned int chunk_end = chnk_id_for_offset( current_size - new_size - 1, gkfs::config::rpc::chunksize); block_index(new_size, gkfs::config::rpc::chunksize); const unsigned int chunk_end = block_index(current_size - new_size - 1, gkfs::config::rpc::chunksize); std::unordered_set<unsigned int> hosts; for(unsigned int chunk_id = chunk_start; chunk_id <= chunk_end; Loading
src/daemon/ops/data.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -53,8 +53,7 @@ ChunkTruncateOperation::truncate_abt(void* _arg) { int err_response = 0; try { // get chunk from where to cut off auto chunk_id_start = chnk_id_for_offset(size, gkfs::config::rpc::chunksize); auto chunk_id_start = block_index(size, gkfs::config::rpc::chunksize); // do not last delete chunk if it is in the middle of a chunk auto left_pad = block_overrun(size, gkfs::config::rpc::chunksize); if(left_pad != 0) { Loading
tests/unit/test_utils_arithmetic.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -391,7 +391,7 @@ SCENARIO(" underrun distance can be computed correctly ", } SCENARIO(" chunk IDs can be computed correctly ", "[utils][numeric][chnk_id_for_offset]") { "[utils][numeric][block_index]") { GIVEN(" an offset and a block size ") { Loading @@ -407,7 +407,7 @@ SCENARIO(" chunk IDs can be computed correctly ", CAPTURE(offset, block_size); THEN(" the computed chunk ID equals 0 ") { const uint64_t id = chnk_id_for_offset(offset, block_size); const uint64_t id = block_index(offset, block_size); const uint64_t expected_id = 0; REQUIRE(id == expected_id); } Loading @@ -421,7 +421,7 @@ SCENARIO(" chunk IDs can be computed correctly ", CAPTURE(offset, block_size); THEN(" the computed chunk ID equals 0 ") { const uint64_t id = chnk_id_for_offset(offset, block_size); const uint64_t id = block_index(offset, block_size); const uint64_t expected_id = 0; REQUIRE(id == expected_id); } Loading @@ -434,7 +434,7 @@ SCENARIO(" chunk IDs can be computed correctly ", CAPTURE(offset, block_size); THEN(" the computed chunk ID equals 0 ") { const uint64_t id = chnk_id_for_offset(offset, block_size); const uint64_t id = block_index(offset, block_size); const uint64_t expected_id = 0; REQUIRE(id == expected_id); } Loading @@ -448,7 +448,7 @@ SCENARIO(" chunk IDs can be computed correctly ", CAPTURE(offset, block_size); THEN(" the computed chunk ID equals 1 ") { const uint64_t id = chnk_id_for_offset(offset, block_size); const uint64_t id = block_index(offset, block_size); const uint64_t expected_id = 1; REQUIRE(id == expected_id); } Loading @@ -468,7 +468,7 @@ SCENARIO(" chunk IDs can be computed correctly ", THEN(" the computed chunk ID is equal to dividing the offset by " "the block_size ") { const uint64_t id = chnk_id_for_offset(offset, block_size); const uint64_t id = block_index(offset, block_size); const uint64_t expected_id = offset / block_size; REQUIRE(id == expected_id); } Loading @@ -485,7 +485,7 @@ SCENARIO(" chunk IDs can be computed correctly ", THEN(" the computed chunk ID is equal to dividing the offset by " "the block_size ") { const uint64_t id = chnk_id_for_offset(offset, block_size); const uint64_t id = block_index(offset, block_size); const uint64_t expected_id = offset / block_size; REQUIRE(id == expected_id); } Loading @@ -501,7 +501,7 @@ SCENARIO(" chunk IDs can be computed correctly ", THEN(" the computed chunk ID is equal to dividing the offset by " "the block_size ") { const uint64_t id = chnk_id_for_offset(offset, block_size); const uint64_t id = block_index(offset, block_size); const uint64_t expected_id = offset / block_size; REQUIRE(id == expected_id); } Loading