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

fix(client): restore else branch on stat cache miss and format code

parent b444aa9e
Loading
Loading
Loading
Loading
Loading
+8 −10
Changes for src/client/gkfs_data.cpp: 8 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -134,10 +134,9 @@ gkfs_do_write(gkfs::filemap::OpenFile& file, const char* buf, size_t count,
                            std::string(buf, count), result.failed_copies);
                }
                gkfs::rpc::record_replica_write(result);
                const bool can_bypass = (num_replicas == 0) &&
                                        CTX->local_bypass() &&
                                        CTX->has_local_host() &&
                                        CTX->fs_conf() &&
                const bool can_bypass =
                        (num_replicas == 0) && CTX->local_bypass() &&
                        CTX->has_local_host() && CTX->fs_conf() &&
                        !CTX->fs_conf()->rootdir.empty();
                if(can_bypass && targets.size() == 1 &&
                   targets[0].host == CTX->local_host_id()) {
@@ -217,10 +216,9 @@ gkfs_do_write(gkfs::filemap::OpenFile& file, const char* buf, size_t count,
                    file.path(), buf, offset, count, is_append, num_replicas);
            err = ret_inline.first;
            if(err == 0) {
                const bool can_bypass = (num_replicas == 0) &&
                                        CTX->local_bypass() &&
                                        CTX->has_local_host() &&
                                        CTX->fs_conf() &&
                const bool can_bypass =
                        (num_replicas == 0) && CTX->local_bypass() &&
                        CTX->has_local_host() && CTX->fs_conf() &&
                        !CTX->fs_conf()->rootdir.empty();
                if(can_bypass) {
                    const auto target = gkfs::rpc::locate_metadata_replica(
@@ -576,8 +574,8 @@ gkfs_do_read(const gkfs::filemap::OpenFile& file, char* buf, size_t count,
        memset(buf, 0, sizeof(char) * count);
    }

    if(gkfs::config::metadata::use_inline_data &&
       offset < gkfs::config::metadata::inline_data_size) {
    if(gkfs::config::metadata::use_inline_data && offset >= 0 &&
       static_cast<size_t>(offset) < gkfs::config::metadata::inline_data_size) {

        // OPTIMIZATION: Check if we have the inline data cached
        // We only use the cache if:
+1 −0
Changes for src/client/preload_util.cpp: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -323,6 +323,7 @@ get_metadata(const string& path, bool follow_links, bool include_inline) {
            errno = ENOENT;
            return {};
        }
    } else {
        // Use file metadata from dentry cache if available
        if(CTX->use_dentry_cache() && CTX->dentry_cache()) {
            // get parent and filename path to retrieve the cache entry
+2 −1
Changes for src/client/rpc/forward_metadata.cpp: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -389,7 +389,8 @@ forward_remove(const std::string& path, bool rm_dir, const int8_t num_copies,
    // we skip it here (CTX->use_proxy() is checked by the caller).
    // Daemons handle the no-op case safely (empty chunk dir == nothing to do).
    if(!rm_dir) {
        bool is_inline = gkfs::config::metadata::use_inline_data &&
        bool is_inline =
                gkfs::config::metadata::use_inline_data &&
                (size >= 0 && static_cast<size_t>(size) <=
                                      gkfs::config::metadata::inline_data_size);