Commit 2fd6c14b authored by Marc Vef's avatar Marc Vef
Browse files

Renaming gkfs_config namespace to gkfs::config

parent f0080049
Loading
Loading
Loading
Loading
+50 −48
Original line number Diff line number Diff line
@@ -20,7 +20,8 @@
#define CLIENT_ENV_PREFIX "LIBGKFS_"
#define DAEMON_ENV_PREFIX "GKFS_"

namespace gkfs_config {
namespace gkfs {
namespace config {

constexpr auto hostfile_path = "./gkfs_hosts.txt";

@@ -30,25 +31,24 @@ namespace gkfs_config {
 * If buffer is not zeroed, sparse regions contain invalid data.
 */
constexpr auto zero_buffer_before_read = false;
    }
} // namespace io

namespace logging {
constexpr auto client_log_path = "/tmp/gkfs_client.log";
constexpr auto daemon_log_path = "/tmp/gkfs_daemon.log";

        constexpr auto client_log_level = "info,errors,critical,mercury";
constexpr auto client_log_level = "info,errors,critical,hermes";
constexpr auto daemon_log_level = 4; //info
    }
} // namespace logging

namespace metadata {

// which metadata should be considered apart from size and mode
constexpr auto use_atime = false;
constexpr auto use_ctime = false;
constexpr auto use_mtime = false;
constexpr auto use_link_cnt = false;
constexpr auto use_blocks = false;
    }
} // namespace metadata

namespace rpc {
constexpr auto chunksize = 524288; // in bytes (e.g., 524288 == 512KB)
@@ -61,12 +61,14 @@ namespace gkfs_config {
constexpr auto daemon_io_xstreams = 8;
// Number of threads used for RPC handlers at the daemon
constexpr auto daemon_handler_xstreams = 8;
    }
} // namespace rpc

namespace rocksdb {
// Write-ahead logging of rocksdb
constexpr auto use_write_ahead_log = false;
    }
}
} // namespace rocksdb

} // namespace gkfs
} // namespace config

#endif //GEKKOFS_CONFIG_HPP
+1 −1
Original line number Diff line number Diff line
@@ -452,7 +452,7 @@ ssize_t gkfs::func::pread(std::shared_ptr<OpenFile> file, char* buf, size_t coun
    }

    // Zeroing buffer before read is only relevant for sparse files. Otherwise sparse regions contain invalid data.
    if (gkfs_config::io::zero_buffer_before_read) {
    if (gkfs::config::io::zero_buffer_before_read) {
        memset(buf, 0, sizeof(char) * count);
    }
    auto ret = rpc_send::read(file->path(), buf, offset, count);
+2 −2
Original line number Diff line number Diff line
@@ -50,10 +50,10 @@ void
PreloadContext::init_logging() {

    const std::string log_opts =
            gkfs::env::get_var(gkfs::env::LOG, gkfs_config::logging::client_log_level);
            gkfs::env::get_var(gkfs::env::LOG, gkfs::config::logging::client_log_level);

    const std::string log_output =
            gkfs::env::get_var(gkfs::env::LOG_OUTPUT, gkfs_config::logging::client_log_path);
            gkfs::env::get_var(gkfs::env::LOG_OUTPUT, gkfs::config::logging::client_log_path);

#ifdef GKFS_DEBUG_BUILD
    // atoi returns 0 if no int conversion can be performed, which works
+2 −2
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ int gkfs::client::metadata_to_stat(const std::string& path, const Metadata& md,
    attr.st_uid = CTX->fs_conf()->uid;
    attr.st_gid = CTX->fs_conf()->gid;
    attr.st_rdev = 0;
    attr.st_blksize = gkfs_config::rpc::chunksize;
    attr.st_blksize = gkfs::config::rpc::chunksize;
    attr.st_blocks = 0;

    memset(&attr.st_atim, 0, sizeof(timespec));
@@ -149,7 +149,7 @@ hermes::endpoint lookup_endpoint(const std::string& uri,
void gkfs::client::load_hosts() {
    string hostfile;

    hostfile = gkfs::env::get_var(gkfs::env::HOSTS_FILE, gkfs_config::hostfile_path);
    hostfile = gkfs::env::get_var(gkfs::env::HOSTS_FILE, gkfs::config::hostfile_path);

    vector<pair<string, string>> hosts;
    try {
+15 −15
Original line number Diff line number Diff line
@@ -39,8 +39,8 @@ ssize_t rpc_send::write(const string& path, const void* buf, const bool append_f
    // which interval to look for chunks
    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, gkfs_config::rpc::chunksize);
    auto chnk_start = chnk_id_for_offset(offset, gkfs::config::rpc::chunksize);
    auto chnk_end = chnk_id_for_offset((offset + write_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
@@ -101,16 +101,16 @@ ssize_t rpc_send::write(const string& path, const void* buf, const bool append_f
    for (const auto& target : targets) {

        // total chunk_size for target
        auto total_chunk_size = target_chnks[target].size() * gkfs_config::rpc::chunksize;
        auto total_chunk_size = target_chnks[target].size() * gkfs::config::rpc::chunksize;

        // receiver of first chunk must subtract the offset from first chunk
        if (target == chnk_start_target) {
            total_chunk_size -= chnk_lpad(offset, gkfs_config::rpc::chunksize);
            total_chunk_size -= chnk_lpad(offset, gkfs::config::rpc::chunksize);
        }

        // receiver of last chunk must subtract
        if (target == chnk_end_target) {
            total_chunk_size -= chnk_rpad(offset + write_size, gkfs_config::rpc::chunksize);
            total_chunk_size -= chnk_rpad(offset + write_size, gkfs::config::rpc::chunksize);
        }

        auto endp = CTX->hosts().at(target);
@@ -123,7 +123,7 @@ ssize_t rpc_send::write(const string& path, const void* buf, const bool append_f
                    path,
                    // first offset in targets is the chunk with
                    // a potential offset
                    chnk_lpad(offset, gkfs_config::rpc::chunksize),
                    chnk_lpad(offset, gkfs::config::rpc::chunksize),
                    target,
                    CTX->hosts().size(),
                    // number of chunks handled by that destination
@@ -195,8 +195,8 @@ ssize_t rpc_send::read(const string& path, void* buf, const off64_t offset, cons

    // 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 = chnk_id_for_offset(offset, gkfs::config::rpc::chunksize);
    auto chnk_end = chnk_id_for_offset((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
@@ -257,16 +257,16 @@ ssize_t rpc_send::read(const string& path, void* buf, const off64_t offset, cons
    for (const auto& target : targets) {

        // total chunk_size for target
        auto total_chunk_size = target_chnks[target].size() * gkfs_config::rpc::chunksize;
        auto total_chunk_size = target_chnks[target].size() * gkfs::config::rpc::chunksize;

        // receiver of first chunk must subtract the offset from first chunk
        if (target == chnk_start_target) {
            total_chunk_size -= chnk_lpad(offset, gkfs_config::rpc::chunksize);
            total_chunk_size -= chnk_lpad(offset, gkfs::config::rpc::chunksize);
        }

        // 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 -= chnk_rpad(offset + read_size, gkfs::config::rpc::chunksize);
        }

        auto endp = CTX->hosts().at(target);
@@ -279,7 +279,7 @@ ssize_t rpc_send::read(const string& path, void* buf, const off64_t offset, cons
                    path,
                    // first offset in targets is the chunk with
                    // a potential offset
                    chnk_lpad(offset, gkfs_config::rpc::chunksize),
                    chnk_lpad(offset, gkfs::config::rpc::chunksize),
                    target,
                    CTX->hosts().size(),
                    // number of chunks handled by that destination
@@ -352,8 +352,8 @@ int rpc_send::trunc_data(const std::string& path, size_t current_size, size_t ne

    // 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);
    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);

    std::unordered_set<unsigned int> hosts;
    for (unsigned int chunk_id = chunk_start; chunk_id <= chunk_end; ++chunk_id) {
@@ -436,7 +436,7 @@ rpc_send::ChunkStat rpc_send::chunk_stat() {
        }
    }

    unsigned long chunk_size = gkfs_config::rpc::chunksize;
    unsigned long chunk_size = gkfs::config::rpc::chunksize;
    unsigned long chunk_total = 0;
    unsigned long chunk_free = 0;

Loading