Loading ifs/configure_public.hpp +2 −2 Original line number Diff line number Diff line Loading @@ -9,13 +9,13 @@ // To enabled logging for daemon #define LOG_INFO //#define LOG_DEBUG #define LOG_TRACE //#define LOG_TRACE #define LOG_DAEMON_PATH "/tmp/adafs_daemon.log" // Enable logging for preload #define LOG_PRELOAD_INFO //#define LOG_PRELOAD_DEBUG #define LOG_PRELOAD_TRACE //#define LOG_PRELOAD_TRACE #define LOG_PRELOAD_PATH "/tmp/adafs_preload.log" // Set a hostname suffix when a connection is built. E.g., "-ib" to use Infiniband Loading ifs/include/db/db_util.hpp +0 −17 Original line number Diff line number Diff line Loading @@ -6,11 +6,6 @@ using namespace std; template<typename E> constexpr typename std::underlying_type<E>::type to_underlying(E e) { return static_cast<typename std::underlying_type<E>::type>(e); } // mapping of enum to string to get the db_keys for metadata enum class Md_fields { atime, mtime, ctime, uid, gid, mode, inode_no, link_count, size, blocks Loading @@ -27,16 +22,4 @@ void optimize_rocksdb(rocksdb::Options& options); std::string db_build_metadentry_value(); // TODO this would build a value based on the number of metadata fields that are used in the fs configuration //std::string db_build_dentry_key(const fuse_ino_t inode, const std::string& name); // //std::string db_build_dentry_prefix(const fuse_ino_t inode); // //std::string db_build_dentry_value(const fuse_ino_t inode, const mode_t mode); // //std::string db_build_mdata_key(const fuse_ino_t inode, const std::string& field); // //string db_build_mdata_key(const string& inode, const string& field); // //std::vector<std::string> db_build_all_mdata_keys(const fuse_ino_t inode); #endif //LFS_DB_UTIL_HPP ifs/include/global_defs.hpp +5 −0 Original line number Diff line number Diff line Loading @@ -16,4 +16,9 @@ namespace hg_tag { constexpr auto read_data = "rpc_srv_read_data"; } template<typename E> constexpr typename std::underlying_type<E>::type to_underlying(E e) { return static_cast<typename std::underlying_type<E>::type>(e); } #endif //IFS_GLOBAL_DEFS_HPP ifs/include/preload/adafs_functions.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ int adafs_stat64(const std::string& path, struct stat64* buf); off_t adafs_lseek(int fd, off_t offset, int whence); off_t adafs_lseek(OpenFile* adafs_fd, off_t offset, int whence); ssize_t adafs_pread_ws(int fd, void* buf, size_t count, off_t offset); ssize_t adafs_pwrite_ws(int fd, const void* buf, size_t count, off_t offset); Loading ifs/include/preload/open_file_map.hpp +20 −37 Original line number Diff line number Diff line Loading @@ -6,60 +6,43 @@ #include <mutex> #include <memory> enum class OpenFile_flags { append = 0, creat, trunc, rdonly, wronly, rdwr, flag_count // this is purely used as a size variable of this enum class }; class OpenFile { private: std::string path_; bool append_flag_; int fd_; // XXX add mutex for pos. If dup is used excessively pos_ may be updated concurrently. The mutex is implemented in pos setter std::array<bool, static_cast<int>(OpenFile_flags::flag_count)> flags_ = {false}; off_t pos_; FILE* tmp_file_; /* XXX shared: - path - flags - pos unique: - sys fd (throw out. is already part as the key in the filemap) - tmp_file - int fd points to same shared ptr in file map - fd attribute is not used -> throw out - put tmp_file into another map<int(fd), FILE*> - Add mutex for pos_ - Let's also properly add all flags from open in there into an enum or similar */ std::mutex pos_mutex_; std::mutex flag_mutex_; public: OpenFile(const std::string& path, bool append_flag); // multiple threads may want to update the file position if fd has been duplicated by dup() ~OpenFile(); OpenFile(const std::string& path, int flags); void annul_fd(); ~OpenFile(); // getter/setter std::string path() const; void path(const std::string& path_); int fd() const; void fd(int fd_); off_t pos() const; off_t pos(); void pos(off_t pos_); bool append_flag() const; const bool get_flag(OpenFile_flags flag); void append_flag(bool append_flag); void set_flag(OpenFile_flags flag, bool value); }; Loading @@ -78,7 +61,7 @@ public: bool exist(int fd); int add(std::string path, bool append); int add(std::string path, int flags); bool remove(int fd); Loading Loading
ifs/configure_public.hpp +2 −2 Original line number Diff line number Diff line Loading @@ -9,13 +9,13 @@ // To enabled logging for daemon #define LOG_INFO //#define LOG_DEBUG #define LOG_TRACE //#define LOG_TRACE #define LOG_DAEMON_PATH "/tmp/adafs_daemon.log" // Enable logging for preload #define LOG_PRELOAD_INFO //#define LOG_PRELOAD_DEBUG #define LOG_PRELOAD_TRACE //#define LOG_PRELOAD_TRACE #define LOG_PRELOAD_PATH "/tmp/adafs_preload.log" // Set a hostname suffix when a connection is built. E.g., "-ib" to use Infiniband Loading
ifs/include/db/db_util.hpp +0 −17 Original line number Diff line number Diff line Loading @@ -6,11 +6,6 @@ using namespace std; template<typename E> constexpr typename std::underlying_type<E>::type to_underlying(E e) { return static_cast<typename std::underlying_type<E>::type>(e); } // mapping of enum to string to get the db_keys for metadata enum class Md_fields { atime, mtime, ctime, uid, gid, mode, inode_no, link_count, size, blocks Loading @@ -27,16 +22,4 @@ void optimize_rocksdb(rocksdb::Options& options); std::string db_build_metadentry_value(); // TODO this would build a value based on the number of metadata fields that are used in the fs configuration //std::string db_build_dentry_key(const fuse_ino_t inode, const std::string& name); // //std::string db_build_dentry_prefix(const fuse_ino_t inode); // //std::string db_build_dentry_value(const fuse_ino_t inode, const mode_t mode); // //std::string db_build_mdata_key(const fuse_ino_t inode, const std::string& field); // //string db_build_mdata_key(const string& inode, const string& field); // //std::vector<std::string> db_build_all_mdata_keys(const fuse_ino_t inode); #endif //LFS_DB_UTIL_HPP
ifs/include/global_defs.hpp +5 −0 Original line number Diff line number Diff line Loading @@ -16,4 +16,9 @@ namespace hg_tag { constexpr auto read_data = "rpc_srv_read_data"; } template<typename E> constexpr typename std::underlying_type<E>::type to_underlying(E e) { return static_cast<typename std::underlying_type<E>::type>(e); } #endif //IFS_GLOBAL_DEFS_HPP
ifs/include/preload/adafs_functions.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ int adafs_stat64(const std::string& path, struct stat64* buf); off_t adafs_lseek(int fd, off_t offset, int whence); off_t adafs_lseek(OpenFile* adafs_fd, off_t offset, int whence); ssize_t adafs_pread_ws(int fd, void* buf, size_t count, off_t offset); ssize_t adafs_pwrite_ws(int fd, const void* buf, size_t count, off_t offset); Loading
ifs/include/preload/open_file_map.hpp +20 −37 Original line number Diff line number Diff line Loading @@ -6,60 +6,43 @@ #include <mutex> #include <memory> enum class OpenFile_flags { append = 0, creat, trunc, rdonly, wronly, rdwr, flag_count // this is purely used as a size variable of this enum class }; class OpenFile { private: std::string path_; bool append_flag_; int fd_; // XXX add mutex for pos. If dup is used excessively pos_ may be updated concurrently. The mutex is implemented in pos setter std::array<bool, static_cast<int>(OpenFile_flags::flag_count)> flags_ = {false}; off_t pos_; FILE* tmp_file_; /* XXX shared: - path - flags - pos unique: - sys fd (throw out. is already part as the key in the filemap) - tmp_file - int fd points to same shared ptr in file map - fd attribute is not used -> throw out - put tmp_file into another map<int(fd), FILE*> - Add mutex for pos_ - Let's also properly add all flags from open in there into an enum or similar */ std::mutex pos_mutex_; std::mutex flag_mutex_; public: OpenFile(const std::string& path, bool append_flag); // multiple threads may want to update the file position if fd has been duplicated by dup() ~OpenFile(); OpenFile(const std::string& path, int flags); void annul_fd(); ~OpenFile(); // getter/setter std::string path() const; void path(const std::string& path_); int fd() const; void fd(int fd_); off_t pos() const; off_t pos(); void pos(off_t pos_); bool append_flag() const; const bool get_flag(OpenFile_flags flag); void append_flag(bool append_flag); void set_flag(OpenFile_flags flag, bool value); }; Loading @@ -78,7 +61,7 @@ public: bool exist(int fd); int add(std::string path, bool append); int add(std::string path, int flags); bool remove(int fd); Loading