Loading ifs/CMakeLists.txt +4 −3 Original line number Diff line number Diff line Loading @@ -53,9 +53,10 @@ set(SOURCE_FILES main.cpp main.hpp configure.hpp util.cpp src/daemon/fs_operations.cpp src/daemon/fs_operations.cpp include/daemon/fs_operations.hpp src/adafs_ops/metadentry.cpp include/adafs_ops/metadentry.hpp src/db/db_ops.cpp src/db/db_ops.cpp include/db/db_ops.hpp src/rpc/handler/h_metadentry.cpp src/rpc/sender/c_metadentry.cpp include/rpc/sender/c_metadentry.hpp src/adafs_ops/data.cpp include/adafs_ops/data.hpp src/rpc/handler/h_data.cpp src/rpc/sender/c_data.cpp include/rpc/sender/c_data.hpp src/rpc/handler/h_preload.cpp) src/rpc/handler/h_metadentry.cpp src/adafs_ops/data.cpp include/adafs_ops/data.hpp src/rpc/handler/h_data.cpp src/rpc/handler/h_preload.cpp ) add_executable(adafs_daemon ${SOURCE_FILES}) target_link_libraries(adafs_daemon ${ROCKSDB_LIBRARIES} # rocksdb libs Loading ifs/configure.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ // Enable logging for daemon #define LOG_PRELOAD_DEBUG 1 #define LOG_PRELOAD_TRACE 1 #define LOG_PRELOAD_PATH "/tmp/adafs_preload.log" // If ACM time should be considered Loading ifs/include/classes/fs_data.hpp +5 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ private: std::string mgmt_path_; // hosts_ std::string hosts_raw_; // raw hosts string, given when daemon is started. Used to give it to fs client std::map<uint64_t, std::string> hosts_; uint64_t host_id_; // my host number size_t host_size_; Loading Loading @@ -157,6 +158,10 @@ public: void rdb_write_options(const rocksdb::WriteOptions& rdb_write_options); const std::string& hosts_raw() const; void hosts_raw(const std::string& hosts_raw); const std::map<uint64_t, std::string>& hosts() const; void hosts(const std::map<uint64_t, std::string>& hosts); Loading ifs/include/preload/ipc_types.hpp +5 −2 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ MERCURY_GEN_PROC(ipc_res_out_t, ((hg_bool_t) (res))) // generic return type // //MERCURY_GEN_PROC(rpc_minimal_out_tt, ((int32_t) (output))) MERCURY_GEN_PROC(ipc_config_in_t, ((int32_t) (dummy))) MERCURY_GEN_PROC(ipc_config_in_t, ((int32_t) (dummy))) // XXX remove that. MERCURY_GEN_PROC(ipc_config_out_t, ((hg_const_string_t) (mountdir)) ((hg_const_string_t) (rootdir)) \ Loading @@ -26,7 +26,10 @@ MERCURY_GEN_PROC(ipc_config_out_t, ((hg_const_string_t) (mountdir)) ((hg_bool_t) (link_cnt_state)) \ ((hg_bool_t) (blocks_state)) \ ((hg_uint32_t) (uid)) \ ((hg_uint32_t) (gid))) ((hg_uint32_t) (gid)) \ ((hg_const_string_t) (hosts_raw)) \ ((hg_uint64_t) (host_id)) \ ((hg_uint64_t) (host_size))) MERCURY_GEN_PROC(ipc_open_in_t, ((hg_const_string_t) (path)) Loading ifs/include/preload/preload.hpp +27 −4 Original line number Diff line number Diff line Loading @@ -40,15 +40,30 @@ struct FsConfig { std::string mountdir; std::string rootdir; // rpc infos std::map<uint64_t, std::string> hosts; uint64_t host_id; // my host number size_t host_size; std::string rpc_port; }; // fs_config is set ONCE in the beginning. It shall not be modified afterwards extern shared_ptr<struct FsConfig> fs_config; extern FILE* debug_fd; #define DAEMON_DEBUG(fd, fmt, ...) \ do { if (LOG_PRELOAD_DEBUG) fprintf(fd, "[" __DATE__ ":" __TIME__ "] " fmt, ##__VA_ARGS__); fflush(fd); } while (0) #define DAEMON_DEBUG0(fd, fmt) \ do { if (LOG_PRELOAD_DEBUG) fprintf(fd, "[" __DATE__ ":" __TIME__ "] " fmt); fflush(fd); } while (0) #define LD_LOG_DEBUG(fd, fmt, ...) \ do { if (LOG_PRELOAD_DEBUG) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [debug]" fmt, ##__VA_ARGS__); fflush(fd); } while (0) #define LD_LOG_TRACE(fd, fmt, ...) \ do { if (LOG_PRELOAD_TRACE) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [debug]" fmt, ##__VA_ARGS__); fflush(fd); } while (0) #define LD_LOG_ERROR(fd, fmt, ...) \ do { fprintf(fd, "[" __DATE__ ":" __TIME__ "] [err]" fmt, ##__VA_ARGS__); fflush(fd); } while (0) #define LD_LOG_DEBUG0(fd, fmt) \ do { if (LOG_PRELOAD_DEBUG) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [debug]" fmt); fflush(fd); } while (0) #define LD_LOG_TRACE0(fd, fmt) \ do { if (LOG_PRELOAD_TRACE) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [debug]" fmt); fflush(fd); } while (0) #define LD_LOG_ERROR0(fd, fmt) \ do { fprintf(fd, "[" __DATE__ ":" __TIME__ "] [err]" fmt); fflush(fd); } while (0) bool init_ld_argobots(); Loading @@ -63,8 +78,16 @@ hg_context_t* ld_mercury_ipc_context(); margo_instance_id ld_margo_ipc_id(); margo_instance_id ld_margo_rpc_id(); hg_addr_t daemon_addr(); bool get_addr_by_hostid(const uint64_t hostid, hg_addr_t& svr_addr); size_t get_rpc_node(const std::string& to_hash); bool is_local_op(const size_t recipient); void init_passthrough_if_needed(); void init_preload(void) __attribute__((constructor)); Loading Loading
ifs/CMakeLists.txt +4 −3 Original line number Diff line number Diff line Loading @@ -53,9 +53,10 @@ set(SOURCE_FILES main.cpp main.hpp configure.hpp util.cpp src/daemon/fs_operations.cpp src/daemon/fs_operations.cpp include/daemon/fs_operations.hpp src/adafs_ops/metadentry.cpp include/adafs_ops/metadentry.hpp src/db/db_ops.cpp src/db/db_ops.cpp include/db/db_ops.hpp src/rpc/handler/h_metadentry.cpp src/rpc/sender/c_metadentry.cpp include/rpc/sender/c_metadentry.hpp src/adafs_ops/data.cpp include/adafs_ops/data.hpp src/rpc/handler/h_data.cpp src/rpc/sender/c_data.cpp include/rpc/sender/c_data.hpp src/rpc/handler/h_preload.cpp) src/rpc/handler/h_metadentry.cpp src/adafs_ops/data.cpp include/adafs_ops/data.hpp src/rpc/handler/h_data.cpp src/rpc/handler/h_preload.cpp ) add_executable(adafs_daemon ${SOURCE_FILES}) target_link_libraries(adafs_daemon ${ROCKSDB_LIBRARIES} # rocksdb libs Loading
ifs/configure.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ // Enable logging for daemon #define LOG_PRELOAD_DEBUG 1 #define LOG_PRELOAD_TRACE 1 #define LOG_PRELOAD_PATH "/tmp/adafs_preload.log" // If ACM time should be considered Loading
ifs/include/classes/fs_data.hpp +5 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ private: std::string mgmt_path_; // hosts_ std::string hosts_raw_; // raw hosts string, given when daemon is started. Used to give it to fs client std::map<uint64_t, std::string> hosts_; uint64_t host_id_; // my host number size_t host_size_; Loading Loading @@ -157,6 +158,10 @@ public: void rdb_write_options(const rocksdb::WriteOptions& rdb_write_options); const std::string& hosts_raw() const; void hosts_raw(const std::string& hosts_raw); const std::map<uint64_t, std::string>& hosts() const; void hosts(const std::map<uint64_t, std::string>& hosts); Loading
ifs/include/preload/ipc_types.hpp +5 −2 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ MERCURY_GEN_PROC(ipc_res_out_t, ((hg_bool_t) (res))) // generic return type // //MERCURY_GEN_PROC(rpc_minimal_out_tt, ((int32_t) (output))) MERCURY_GEN_PROC(ipc_config_in_t, ((int32_t) (dummy))) MERCURY_GEN_PROC(ipc_config_in_t, ((int32_t) (dummy))) // XXX remove that. MERCURY_GEN_PROC(ipc_config_out_t, ((hg_const_string_t) (mountdir)) ((hg_const_string_t) (rootdir)) \ Loading @@ -26,7 +26,10 @@ MERCURY_GEN_PROC(ipc_config_out_t, ((hg_const_string_t) (mountdir)) ((hg_bool_t) (link_cnt_state)) \ ((hg_bool_t) (blocks_state)) \ ((hg_uint32_t) (uid)) \ ((hg_uint32_t) (gid))) ((hg_uint32_t) (gid)) \ ((hg_const_string_t) (hosts_raw)) \ ((hg_uint64_t) (host_id)) \ ((hg_uint64_t) (host_size))) MERCURY_GEN_PROC(ipc_open_in_t, ((hg_const_string_t) (path)) Loading
ifs/include/preload/preload.hpp +27 −4 Original line number Diff line number Diff line Loading @@ -40,15 +40,30 @@ struct FsConfig { std::string mountdir; std::string rootdir; // rpc infos std::map<uint64_t, std::string> hosts; uint64_t host_id; // my host number size_t host_size; std::string rpc_port; }; // fs_config is set ONCE in the beginning. It shall not be modified afterwards extern shared_ptr<struct FsConfig> fs_config; extern FILE* debug_fd; #define DAEMON_DEBUG(fd, fmt, ...) \ do { if (LOG_PRELOAD_DEBUG) fprintf(fd, "[" __DATE__ ":" __TIME__ "] " fmt, ##__VA_ARGS__); fflush(fd); } while (0) #define DAEMON_DEBUG0(fd, fmt) \ do { if (LOG_PRELOAD_DEBUG) fprintf(fd, "[" __DATE__ ":" __TIME__ "] " fmt); fflush(fd); } while (0) #define LD_LOG_DEBUG(fd, fmt, ...) \ do { if (LOG_PRELOAD_DEBUG) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [debug]" fmt, ##__VA_ARGS__); fflush(fd); } while (0) #define LD_LOG_TRACE(fd, fmt, ...) \ do { if (LOG_PRELOAD_TRACE) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [debug]" fmt, ##__VA_ARGS__); fflush(fd); } while (0) #define LD_LOG_ERROR(fd, fmt, ...) \ do { fprintf(fd, "[" __DATE__ ":" __TIME__ "] [err]" fmt, ##__VA_ARGS__); fflush(fd); } while (0) #define LD_LOG_DEBUG0(fd, fmt) \ do { if (LOG_PRELOAD_DEBUG) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [debug]" fmt); fflush(fd); } while (0) #define LD_LOG_TRACE0(fd, fmt) \ do { if (LOG_PRELOAD_TRACE) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [debug]" fmt); fflush(fd); } while (0) #define LD_LOG_ERROR0(fd, fmt) \ do { fprintf(fd, "[" __DATE__ ":" __TIME__ "] [err]" fmt); fflush(fd); } while (0) bool init_ld_argobots(); Loading @@ -63,8 +78,16 @@ hg_context_t* ld_mercury_ipc_context(); margo_instance_id ld_margo_ipc_id(); margo_instance_id ld_margo_rpc_id(); hg_addr_t daemon_addr(); bool get_addr_by_hostid(const uint64_t hostid, hg_addr_t& svr_addr); size_t get_rpc_node(const std::string& to_hash); bool is_local_op(const size_t recipient); void init_passthrough_if_needed(); void init_preload(void) __attribute__((constructor)); Loading