Loading include/config.hpp +4 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,9 @@ namespace gkfs { namespace config { // writes to dev null instead of chunk space, read is reading /dev/zero constexpr bool limbo_mode = true; constexpr auto hostfile_path = "./gkfs_hosts.txt"; namespace io { Loading Loading @@ -51,7 +54,7 @@ constexpr auto use_blocks = false; } // namespace metadata namespace rpc { constexpr auto chunksize = 524288; // in bytes (e.g., 524288 == 512KB) constexpr auto chunksize = 16 * 1024 * 1024; // in MiB (e.g., 524288 == 512KB) //size of preallocated buffer to hold directory entries in rpc call constexpr auto dirents_buff_size = (8 * 1024 * 1024); // 8 mega /* Loading src/daemon/backend/data/chunk_storage.cpp +18 −5 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <boost/filesystem.hpp> #include <spdlog/spdlog.h> #include <config.hpp> extern "C" { #include <sys/statfs.h> Loading Loading @@ -124,10 +125,16 @@ ChunkStorage::write_chunk(const string& file_path, gkfs::rpc::chnk_id_t chunk_id off64_t offset) const { assert((offset + size) <= chunksize_); string chunk_path = ""s; if (gkfs::config::limbo_mode) { chunk_path = "/dev/null"s; } else { // may throw ChunkStorageException on failure init_chunk_space(file_path); auto chunk_path = absolute(get_chunk_path(file_path, chunk_id)); chunk_path = absolute(get_chunk_path(file_path, chunk_id)); } log_->trace("{}() Before open with chunk path '{}'", __func__, chunk_path); int fd = open(chunk_path.c_str(), O_WRONLY | O_CREAT, 0640); if (fd < 0) { auto err_str = fmt::format("Failed to open chunk file for write. File: '{}', Error: '{}'", chunk_path, Loading Loading @@ -167,7 +174,13 @@ ssize_t ChunkStorage::read_chunk(const string& file_path, gkfs::rpc::chnk_id_t chunk_id, char* buf, size_t size, off64_t offset) const { assert((offset + size) <= chunksize_); auto chunk_path = absolute(get_chunk_path(file_path, chunk_id)); string chunk_path = ""s; if (gkfs::config::limbo_mode) { chunk_path = "/dev/zero"s; } else { chunk_path = absolute(get_chunk_path(file_path, chunk_id)); } log_->trace("{}() Before open with chunk path '{}'", __func__, chunk_path); int fd = open(chunk_path.c_str(), O_RDONLY); if (fd < 0) { auto err_str = fmt::format("Failed to open chunk file for read. File: '{}', Error: '{}'", chunk_path, Loading src/daemon/ops/metadentry.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ void remove(const string& path) { try { GKFS_DATA->mdb()->remove(path); // remove metadata from KV store } catch (const NotFoundException& e) {} if (!gkfs::config::limbo_mode) GKFS_DATA->storage()->destroy_chunk_space(path); // destroys all chunks for the path on this node } Loading Loading
include/config.hpp +4 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,9 @@ namespace gkfs { namespace config { // writes to dev null instead of chunk space, read is reading /dev/zero constexpr bool limbo_mode = true; constexpr auto hostfile_path = "./gkfs_hosts.txt"; namespace io { Loading Loading @@ -51,7 +54,7 @@ constexpr auto use_blocks = false; } // namespace metadata namespace rpc { constexpr auto chunksize = 524288; // in bytes (e.g., 524288 == 512KB) constexpr auto chunksize = 16 * 1024 * 1024; // in MiB (e.g., 524288 == 512KB) //size of preallocated buffer to hold directory entries in rpc call constexpr auto dirents_buff_size = (8 * 1024 * 1024); // 8 mega /* Loading
src/daemon/backend/data/chunk_storage.cpp +18 −5 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <boost/filesystem.hpp> #include <spdlog/spdlog.h> #include <config.hpp> extern "C" { #include <sys/statfs.h> Loading Loading @@ -124,10 +125,16 @@ ChunkStorage::write_chunk(const string& file_path, gkfs::rpc::chnk_id_t chunk_id off64_t offset) const { assert((offset + size) <= chunksize_); string chunk_path = ""s; if (gkfs::config::limbo_mode) { chunk_path = "/dev/null"s; } else { // may throw ChunkStorageException on failure init_chunk_space(file_path); auto chunk_path = absolute(get_chunk_path(file_path, chunk_id)); chunk_path = absolute(get_chunk_path(file_path, chunk_id)); } log_->trace("{}() Before open with chunk path '{}'", __func__, chunk_path); int fd = open(chunk_path.c_str(), O_WRONLY | O_CREAT, 0640); if (fd < 0) { auto err_str = fmt::format("Failed to open chunk file for write. File: '{}', Error: '{}'", chunk_path, Loading Loading @@ -167,7 +174,13 @@ ssize_t ChunkStorage::read_chunk(const string& file_path, gkfs::rpc::chnk_id_t chunk_id, char* buf, size_t size, off64_t offset) const { assert((offset + size) <= chunksize_); auto chunk_path = absolute(get_chunk_path(file_path, chunk_id)); string chunk_path = ""s; if (gkfs::config::limbo_mode) { chunk_path = "/dev/zero"s; } else { chunk_path = absolute(get_chunk_path(file_path, chunk_id)); } log_->trace("{}() Before open with chunk path '{}'", __func__, chunk_path); int fd = open(chunk_path.c_str(), O_RDONLY); if (fd < 0) { auto err_str = fmt::format("Failed to open chunk file for read. File: '{}', Error: '{}'", chunk_path, Loading
src/daemon/ops/metadentry.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ void remove(const string& path) { try { GKFS_DATA->mdb()->remove(path); // remove metadata from KV store } catch (const NotFoundException& e) {} if (!gkfs::config::limbo_mode) GKFS_DATA->storage()->destroy_chunk_space(path); // destroys all chunks for the path on this node } Loading