Commit f0f63158 authored by Ramon Nou's avatar Ramon Nou
Browse files

feat(client): implement local chunk zero-RPC shortcut/bypass for client node == server node

parent b4837c5a
Loading
Loading
Loading
Loading
Loading
+2 −0
Changes for include/client/env.hpp: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -115,6 +115,8 @@ static constexpr auto FUSE_ATTR_TIMEOUT = ADD_PREFIX("FUSE_ATTR_TIMEOUT");
static constexpr auto FUSE_NEGATIVE_TIMEOUT =
        ADD_PREFIX("FUSE_NEGATIVE_TIMEOUT");
static constexpr auto FUSE_WRITEBACK = ADD_PREFIX("FUSE_WRITEBACK");
static constexpr auto ENABLE_LOCAL_BYPASS = ADD_PREFIX("ENABLE_LOCAL_BYPASS");
static constexpr auto LOCAL_BYPASS = ADD_PREFIX("LOCAL_BYPASS");

// Libfabric interface pinning (consumed by libfabric at HG_init() time)
// OFI_INTERFACE is used with the GKFS_ prefix (e.g., LIBGKFS_OFI_INTERFACE)
+14 −0
Changes for include/client/preload_context.hpp: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -150,6 +150,8 @@ private:
    bool clear_dentry_cache_on_close_{true};
    std::shared_ptr<gkfs::cache::file::WriteSizeCache> write_size_cache_;
    bool use_write_size_cache_{false};
    bool local_bypass_{true};
    bool has_local_host_{false};


    std::string cwd_;
@@ -387,6 +389,18 @@ public:
    void
    use_write_size_cache(bool use_dentry_cache);

    bool
    local_bypass() const;

    void
    local_bypass(bool enable);

    bool
    has_local_host() const;

    void
    has_local_host(bool has);

    void
    enable_interception();

+13 −0
Changes for src/client/preload.cpp: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -710,6 +710,19 @@ init_preload() {
                                       ? "ON"
                                       : "OFF") == "ON";

    bool bypass_enabled = true;
    if(gkfs::env::var_is_set(gkfs::env::ENABLE_LOCAL_BYPASS)) {
        bypass_enabled = gkfs::env::get_var_bool(gkfs::env::ENABLE_LOCAL_BYPASS, true);
    } else if(gkfs::env::var_is_set(gkfs::env::LOCAL_BYPASS)) {
        bypass_enabled = gkfs::env::get_var_bool(gkfs::env::LOCAL_BYPASS, true);
    } else if(gkfs::env::var_is_set("LIBGKFS_ENABLE_LOCAL_BYPASS")) {
        bypass_enabled = gkfs::env::get_var_bool("LIBGKFS_ENABLE_LOCAL_BYPASS", true);
    } else if(gkfs::env::var_is_set("LIBGKFS_LOCAL_BYPASS")) {
        bypass_enabled = gkfs::env::get_var_bool("LIBGKFS_LOCAL_BYPASS", true);
    }
    CTX->local_bypass(bypass_enabled);
    LOG(INFO, "Local chunk bypass: {}", CTX->local_bypass() ? "ON" : "OFF");

#ifndef BYPASS_SYSCALL
    gkfs::preload::start_interception();
#endif
+20 −0
Changes for src/client/preload_context.cpp: 20 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -662,6 +662,26 @@ PreloadContext::use_write_size_cache(bool use_write_size_cache) {
    use_write_size_cache_ = use_write_size_cache;
}

bool
PreloadContext::local_bypass() const {
    return local_bypass_;
}

void
PreloadContext::local_bypass(bool enable) {
    local_bypass_ = enable;
}

bool
PreloadContext::has_local_host() const {
    return has_local_host_;
}

void
PreloadContext::has_local_host(bool has) {
    has_local_host_ = has;
}

void
PreloadContext::enable_interception() {
    interception_enabled_ = true;
+1 −0
Changes for src/client/preload_util.cpp: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -644,6 +644,7 @@ connect_to_hosts(const vector<pair<string, string>>& hosts) {
        LOG(WARNING, "Failed to find local host. Using host '0' as local host");
        local_host_id = 0;
    }
    CTX->has_local_host(local_host_found);

    return {std::move(addrs), local_host_id};
}
Loading