Loading include/client/open_file_map.hpp +0 −2 Original line number Diff line number Diff line Loading @@ -200,8 +200,6 @@ public: int get_fd_idx(); std::vector<int> get_range(unsigned int first, unsigned int last); bool empty() const; Loading include/client/rpc/forward_metadata.hpp +2 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,8 @@ forward_rename(const std::string& oldpath, const std::string& newpath, const gkfs::metadata::Metadata& md); int forward_remove(const std::string& path, bool rm_dir, const int8_t num_copies); forward_remove(const std::string& path, bool rm_dir, const int8_t num_copies, int64_t size); int forward_decr_size(const std::string& path, size_t length, const int copy); Loading src/client/gkfs_metadata.cpp +14 −12 Original line number Diff line number Diff line Loading @@ -162,7 +162,7 @@ generate_lock_file(const std::string& path, bool increase) { if(md) { if(md->size() == 1 || md->size() == 0) { LOG(DEBUG, "Deleting Lock file {}", lock_path); gkfs::rpc::forward_remove(lock_path, false, 0); gkfs::rpc::forward_remove(lock_path, false, 0, md->size()); } else { gkfs::rpc::forward_decr_size(lock_path, md.value().size() - 1, 0); Loading Loading @@ -471,13 +471,13 @@ gkfs_libcremove(const std::string& path) { */ int gkfs_remove(const std::string& path) { if(gkfs::config::metadata::rename_support) { auto md = gkfs::utils::get_metadata(path); if(!md) { return -1; } if(gkfs::config::metadata::rename_support) { if(S_ISDIR(md->mode())) { LOG(ERROR, "Cannot remove directory '{}'", path); errno = EISDIR; Loading @@ -502,8 +502,8 @@ gkfs_remove(const std::string& path) { return -1; } } auto err = gkfs::rpc::forward_remove(new_path, false, CTX->get_replicas()); auto err = gkfs::rpc::forward_remove( new_path, false, CTX->get_replicas(), md->size()); if(err) { errno = err; return -1; Loading @@ -517,7 +517,8 @@ gkfs_remove(const std::string& path) { if(gkfs::config::proxy::fwd_remove && CTX->use_proxy()) { err = gkfs::rpc::forward_remove_proxy(path, false); } else { err = gkfs::rpc::forward_remove(path, false, CTX->get_replicas()); err = gkfs::rpc::forward_remove(path, false, CTX->get_replicas(), md->size()); } if(err) { errno = err; Loading Loading @@ -601,8 +602,8 @@ gkfs_rename(const string& old_path, const string& new_path) { auto is_dir = false; if(S_ISDIR(md_old->mode())) is_dir = true; err = gkfs::rpc::forward_remove(old_path, is_dir, CTX->get_replicas()); err = gkfs::rpc::forward_remove( old_path, is_dir, CTX->get_replicas(), md_old->size()); if(err) { errno = err; return -1; Loading Loading @@ -636,7 +637,8 @@ gkfs_rename(const string& old_path, const string& new_path) { if(S_ISDIR(md_old->mode())) is_dir = true; // Remove intermediate file gkfs::rpc::forward_remove(old_path, is_dir, CTX->get_replicas()); gkfs::rpc::forward_remove(old_path, is_dir, CTX->get_replicas(), md_old->size()); } int err = 0; if(!S_ISLNK(md_old->mode())) { Loading Loading @@ -1365,7 +1367,7 @@ gkfs_rmdir(const std::string& path) { if(gkfs::config::proxy::fwd_remove && CTX->use_proxy()) { err = gkfs::rpc::forward_remove_proxy(path, true); } else { err = gkfs::rpc::forward_remove(path, true, CTX->get_replicas()); err = gkfs::rpc::forward_remove(path, true, CTX->get_replicas(), 0); } if(err) { errno = err; Loading src/client/intercept.cpp +9 −11 Original line number Diff line number Diff line Loading @@ -593,18 +593,16 @@ hook(long syscall_number, long arg0, long arg1, long arg2, long arg3, long arg4, auto last = static_cast<unsigned int>(arg1); auto flags = static_cast<unsigned int>(arg2); // Close any GekkoFS virtual fds in the range ourselves. // Iterate only over our tracked fds to avoid touching native fds. auto to_close = CTX->file_map()->get_range(first, last); for(auto fd : to_close) { auto fds = get_open_fds(); for(auto fd : fds) { if(fd < first || fd > last) continue; if(CTX->file_map()->exist(fd)) { gkfs::syscall::gkfs_close(fd); } else close(fd); } // Forward the range to the kernel for all native fds. // The kernel handles O_CLOEXEC semantics and won't touch our // internal fds (which live in the upper fd range). *result = syscall_no_intercept_wrapper(SYS_close_range, first, last, flags); *result = 0; break; } #endif // SYS_close_range Loading src/client/open_file_map.cpp +0 −15 Original line number Diff line number Diff line Loading @@ -341,21 +341,6 @@ OpenFileMap::get_fd_idx() { return fd_idx; } std::vector<int> OpenFileMap::get_range(unsigned int first, unsigned int last) { std::vector<int> result; for(auto& shard : shards_) { lock_guard<recursive_mutex> lock(shard.mutex); auto it = shard.files.lower_bound(static_cast<int>(first)); while(it != shard.files.end() && static_cast<unsigned int>(it->first) <= last) { result.push_back(it->first); ++it; } } std::sort(result.begin(), result.end()); return result; } bool OpenFileMap::empty() const { Loading Loading
include/client/open_file_map.hpp +0 −2 Original line number Diff line number Diff line Loading @@ -200,8 +200,6 @@ public: int get_fd_idx(); std::vector<int> get_range(unsigned int first, unsigned int last); bool empty() const; Loading
include/client/rpc/forward_metadata.hpp +2 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,8 @@ forward_rename(const std::string& oldpath, const std::string& newpath, const gkfs::metadata::Metadata& md); int forward_remove(const std::string& path, bool rm_dir, const int8_t num_copies); forward_remove(const std::string& path, bool rm_dir, const int8_t num_copies, int64_t size); int forward_decr_size(const std::string& path, size_t length, const int copy); Loading
src/client/gkfs_metadata.cpp +14 −12 Original line number Diff line number Diff line Loading @@ -162,7 +162,7 @@ generate_lock_file(const std::string& path, bool increase) { if(md) { if(md->size() == 1 || md->size() == 0) { LOG(DEBUG, "Deleting Lock file {}", lock_path); gkfs::rpc::forward_remove(lock_path, false, 0); gkfs::rpc::forward_remove(lock_path, false, 0, md->size()); } else { gkfs::rpc::forward_decr_size(lock_path, md.value().size() - 1, 0); Loading Loading @@ -471,13 +471,13 @@ gkfs_libcremove(const std::string& path) { */ int gkfs_remove(const std::string& path) { if(gkfs::config::metadata::rename_support) { auto md = gkfs::utils::get_metadata(path); if(!md) { return -1; } if(gkfs::config::metadata::rename_support) { if(S_ISDIR(md->mode())) { LOG(ERROR, "Cannot remove directory '{}'", path); errno = EISDIR; Loading @@ -502,8 +502,8 @@ gkfs_remove(const std::string& path) { return -1; } } auto err = gkfs::rpc::forward_remove(new_path, false, CTX->get_replicas()); auto err = gkfs::rpc::forward_remove( new_path, false, CTX->get_replicas(), md->size()); if(err) { errno = err; return -1; Loading @@ -517,7 +517,8 @@ gkfs_remove(const std::string& path) { if(gkfs::config::proxy::fwd_remove && CTX->use_proxy()) { err = gkfs::rpc::forward_remove_proxy(path, false); } else { err = gkfs::rpc::forward_remove(path, false, CTX->get_replicas()); err = gkfs::rpc::forward_remove(path, false, CTX->get_replicas(), md->size()); } if(err) { errno = err; Loading Loading @@ -601,8 +602,8 @@ gkfs_rename(const string& old_path, const string& new_path) { auto is_dir = false; if(S_ISDIR(md_old->mode())) is_dir = true; err = gkfs::rpc::forward_remove(old_path, is_dir, CTX->get_replicas()); err = gkfs::rpc::forward_remove( old_path, is_dir, CTX->get_replicas(), md_old->size()); if(err) { errno = err; return -1; Loading Loading @@ -636,7 +637,8 @@ gkfs_rename(const string& old_path, const string& new_path) { if(S_ISDIR(md_old->mode())) is_dir = true; // Remove intermediate file gkfs::rpc::forward_remove(old_path, is_dir, CTX->get_replicas()); gkfs::rpc::forward_remove(old_path, is_dir, CTX->get_replicas(), md_old->size()); } int err = 0; if(!S_ISLNK(md_old->mode())) { Loading Loading @@ -1365,7 +1367,7 @@ gkfs_rmdir(const std::string& path) { if(gkfs::config::proxy::fwd_remove && CTX->use_proxy()) { err = gkfs::rpc::forward_remove_proxy(path, true); } else { err = gkfs::rpc::forward_remove(path, true, CTX->get_replicas()); err = gkfs::rpc::forward_remove(path, true, CTX->get_replicas(), 0); } if(err) { errno = err; Loading
src/client/intercept.cpp +9 −11 Original line number Diff line number Diff line Loading @@ -593,18 +593,16 @@ hook(long syscall_number, long arg0, long arg1, long arg2, long arg3, long arg4, auto last = static_cast<unsigned int>(arg1); auto flags = static_cast<unsigned int>(arg2); // Close any GekkoFS virtual fds in the range ourselves. // Iterate only over our tracked fds to avoid touching native fds. auto to_close = CTX->file_map()->get_range(first, last); for(auto fd : to_close) { auto fds = get_open_fds(); for(auto fd : fds) { if(fd < first || fd > last) continue; if(CTX->file_map()->exist(fd)) { gkfs::syscall::gkfs_close(fd); } else close(fd); } // Forward the range to the kernel for all native fds. // The kernel handles O_CLOEXEC semantics and won't touch our // internal fds (which live in the upper fd range). *result = syscall_no_intercept_wrapper(SYS_close_range, first, last, flags); *result = 0; break; } #endif // SYS_close_range Loading
src/client/open_file_map.cpp +0 −15 Original line number Diff line number Diff line Loading @@ -341,21 +341,6 @@ OpenFileMap::get_fd_idx() { return fd_idx; } std::vector<int> OpenFileMap::get_range(unsigned int first, unsigned int last) { std::vector<int> result; for(auto& shard : shards_) { lock_guard<recursive_mutex> lock(shard.mutex); auto it = shard.files.lower_bound(static_cast<int>(first)); while(it != shard.files.end() && static_cast<unsigned int>(it->first) <= last) { result.push_back(it->first); ++it; } } std::sort(result.begin(), result.end()); return result; } bool OpenFileMap::empty() const { Loading