Commit 1d3dfb8f authored by Marc Vef's avatar Marc Vef
Browse files

unfinished: optimizing path resolution performance

Moving path code from preload context, updating hooks.cpp with new method
parent 9d353954
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

namespace gkfs::path {

enum class NormalizeStatus { ok, fd_unknown, fd_not_a_dir };

unsigned int
match_components(const std::string& path, unsigned int& path_components,
                 const std::vector<std::string>& components);
@@ -24,6 +26,16 @@ bool
resolve(const std::string& path, std::string& resolved,
        bool resolve_last_link = true);

NormalizeStatus
normalize(int dirfd, const char* raw_path, std::string& normalized_path,
          bool resolve_last_link = true);

std::string
normalize(const char* raw_path, bool resolve_last_link = true);

bool
is_in_gkfs(std::string& path, bool cut_mountdir_prefix = false);

std::string
get_sys_cwd();

+0 −11
Original line number Diff line number Diff line
@@ -53,8 +53,6 @@ struct FsConfig {
    std::string rootdir;
};

enum class RelativizeStatus { internal, external, fd_unknown, fd_not_a_dir };

/**
 * Singleton class of the client context with all relevant global data
 */
@@ -150,15 +148,6 @@ public:
    void
    auto_sm(bool auto_sm);

    RelativizeStatus
    relativize_fd_path(int dirfd, const char* raw_path,
                       std::string& relative_path,
                       bool resolve_last_link = true) const;

    bool
    relativize_path(const char* raw_path, std::string& relative_path,
                    bool resolve_last_link = true) const;

    const std::shared_ptr<gkfs::filemap::OpenFileMap>&
    file_map() const;

+10 −0
Original line number Diff line number Diff line
@@ -81,6 +81,16 @@ namespace rocksdb {
constexpr auto use_write_ahead_log = false;
} // namespace rocksdb

namespace preload {
/*
 * This option allows a symlink outside of the GekkoFS namespace into the
 * GekkoFS namespace. This is by default disabled as it incurs a significant
 * overhead during GekkoFS' path resolution. Therefore, it is recommended to
 * keep it disabled
 */
constexpr auto allow_symlinks_into_gkfs = false;
} // namespace preload

} // namespace gkfs::config

#endif // GEKKOFS_CONFIG_HPP
Loading