Loading lfs/src/classes/fs_data.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -142,14 +142,22 @@ void FsData::inode_count(fuse_ino_t inode_count) { FsData::inode_count_ = inode_count; } const std::vector<std::string>& FsData::hosts() const { const std::map<std::string, unsigned int>& FsData::hosts() const { return hosts_; } void FsData::hosts(const std::vector<std::string>& hosts) { void FsData::hosts(const std::map<std::string, unsigned int>& hosts) { FsData::hosts_ = hosts; } const std::string& FsData::hostname() const { return hostname_; } unsigned long FsData::hostname(const std::string& hostname) { FsData::hostname_ = hostname; return hostname.size(); } // Utility member functions fuse_ino_t FsData::raise_inode_count(fuse_ino_t count) { Loading @@ -160,3 +168,4 @@ fuse_ino_t FsData::raise_inode_count(fuse_ino_t count) { lfs/src/classes/fs_data.hpp +10 −3 Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ #define LFS_FS_DATA_H #include "../main.hpp" #include <map> class FsData { Loading Loading @@ -33,7 +35,8 @@ private: std::string mgmt_path_; // hosts_ std::vector<std::string> hosts_; std::map<std::string, unsigned int> hosts_; std::string hostname_; // rocksdb std::shared_ptr<rocksdb::DB> rdb_; Loading Loading @@ -128,9 +131,13 @@ public: void rdb_write_options(const rocksdb::WriteOptions& rdb_write_options); const std::vector<std::string>& hosts() const; const std::map<std::string, unsigned int>& hosts() const; void hosts(const std::map<std::string, unsigned int>& hosts); const std::string& hostname() const; void hosts(const std::vector<std::string>& hosts); unsigned long hostname(const std::string& hostname); // Utility member functions Loading lfs/src/main.cpp +13 −4 Original line number Diff line number Diff line #include <future> #include "main.hpp" #include <future> #include "classes/metadata.hpp" #include "adafs_ops/mdata_ops.hpp" #include "adafs_ops/dentry_ops.hpp" Loading @@ -14,7 +14,7 @@ using namespace std; namespace po = boost::program_options; struct tmp_fuse_usr { std::vector<std::string> hosts; std::map<std::string, unsigned int> hosts; std::string hostfile; }; Loading Loading @@ -42,6 +42,7 @@ void init_rpc_env(promise<bool> rpc_promise) { rpc_promise.set_value(true); margo_wait_for_finalize(mid); } /** * Initialize filesystem * Loading @@ -65,6 +66,12 @@ void adafs_ll_init(void* pdata, struct fuse_conn_info* conn) { auto fuse_data = static_cast<tmp_fuse_usr*>(pdata); ADAFS_DATA->hosts(fuse_data->hosts); auto hostname_size = ADAFS_DATA->hostname(Util::get_my_hostname()); if (hostname_size == 0) { ADAFS_DATA->spdlogger()->error("Unable to read the machine's hostname"); assert(hostname_size != 0); } // Make sure directory structure exists bfs::create_directories(ADAFS_DATA->dentry_path()); bfs::create_directories(ADAFS_DATA->inode_path()); Loading Loading @@ -200,7 +207,7 @@ void err_cleanup3(fuse_session& se) { * @param argv * @return */ int main(int argc, char* argv[]) { int main(int argc, const char* argv[]) { //Initialize the mapping of Fuse functions init_adafs_ops(&adafs_ops); Loading Loading @@ -258,10 +265,12 @@ int main(int argc, char* argv[]) { // XXX Hostfile parsing here... if (vm.count("hosts")) { auto hosts = vm["hosts"].as<string>(); unsigned int i = 0; // split comma separated host string boost::tokenizer<> tok(hosts); for (auto&& s : tok) { fuse_struct->hosts.push_back(s); fuse_struct->hosts[s] = i; i++; } } Loading lfs/src/main.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,8 @@ namespace Util { int read_inode_cnt(); int write_inode_cnt(); std::string get_my_hostname(); } #endif //MAIN_H lfs/src/rpc/rpc_util.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -19,13 +19,13 @@ bool init_argobots() { // We need no arguments to init auto argo_err = ABT_init(0, nullptr); if (argo_err != 0) { ADAFS_DATA->spdlogger()->info("[ERR]: ABT_init() Failed to init Argobots (client)"); ADAFS_DATA->spdlogger()->error("ABT_init() Failed to init Argobots (client)"); return false; } // Set primary execution stream to idle without polling. Normally xstreams cannot sleep. This is what ABT_snoozer does argo_err = ABT_snoozer_xstream_self_set(); if (argo_err != 0) { ADAFS_DATA->spdlogger()->info("[ERR]: ABT_snoozer_xstream_self_set() (client)"); ADAFS_DATA->spdlogger()->error("ABT_snoozer_xstream_self_set() (client)"); return false; } ADAFS_DATA->spdlogger()->info("Success."); Loading @@ -41,7 +41,7 @@ void destroy_argobots() { if (ret == ABT_SUCCESS) { ADAFS_DATA->spdlogger()->info("Argobots successfully shutdown."); } else { ADAFS_DATA->spdlogger()->info("Argobots shutdown FAILED with err code {}", ret); ADAFS_DATA->spdlogger()->error("Argobots shutdown FAILED with err code {}", ret); } } Loading @@ -66,13 +66,13 @@ bool init_rpc_server() { // Init Mercury layer (must be finalized when finished) hg_class = HG_Init(protocol_port.c_str(), HG_TRUE); if (hg_class == nullptr) { ADAFS_DATA->spdlogger()->info("[ERR]: HG_Init() Failed to init Mercury server layer"); ADAFS_DATA->spdlogger()->error("HG_Init() Failed to init Mercury server layer"); return false; } // Create a new Mercury context (must be destroyed when finished) hg_context = HG_Context_create(hg_class); if (hg_context == nullptr) { ADAFS_DATA->spdlogger()->info("[ERR]: HG_Context_create() Failed to create Mercury server context"); ADAFS_DATA->spdlogger()->error("HG_Context_create() Failed to create Mercury server context"); HG_Finalize(hg_class); return false; } Loading @@ -80,7 +80,7 @@ bool init_rpc_server() { // Figure out what address this server is listening on (must be freed when finished) auto hg_ret = HG_Addr_self(hg_class, &addr_self); if (hg_ret != HG_SUCCESS) { ADAFS_DATA->spdlogger()->info("[ERR]: HG_Addr_self() Failed to retrieve server address"); ADAFS_DATA->spdlogger()->error("HG_Addr_self() Failed to retrieve server address"); HG_Context_destroy(hg_context); HG_Finalize(hg_class); return false; Loading @@ -88,7 +88,7 @@ bool init_rpc_server() { // Convert the address to a cstring (with \0 terminator). hg_ret = HG_Addr_to_string(hg_class, addr_self_cstring, &addr_self_cstring_sz, addr_self); if (hg_ret != HG_SUCCESS) { ADAFS_DATA->spdlogger()->info("[ERR]: HG_Addr_to_string Failed to convert address to cstring"); ADAFS_DATA->spdlogger()->error("HG_Addr_to_string Failed to convert address to cstring"); HG_Context_destroy(hg_context); HG_Finalize(hg_class); HG_Addr_free(hg_class, addr_self); Loading @@ -103,7 +103,7 @@ bool init_rpc_server() { // Start Margo auto mid = margo_init(0, 0, hg_context); if (mid == MARGO_INSTANCE_NULL) { ADAFS_DATA->spdlogger()->info("[ERR]: margo_init failed to initialize the Margo server"); ADAFS_DATA->spdlogger()->error("margo_init failed to initialize the Margo server"); HG_Context_destroy(hg_context); HG_Finalize(hg_class); return false; Loading Loading @@ -148,13 +148,13 @@ bool init_rpc_client() { hg_context_t* hg_context; hg_class = HG_Init(protocol_port.c_str(), HG_FALSE); if (hg_class == nullptr) { ADAFS_DATA->spdlogger()->info("[ERR]: HG_Init() Failed to init Mercury client layer"); ADAFS_DATA->spdlogger()->error("HG_Init() Failed to init Mercury client layer"); return false; } // Create a new Mercury context (must be destroyed when finished) hg_context = HG_Context_create(hg_class); if (hg_context == nullptr) { ADAFS_DATA->spdlogger()->info("[ERR]: HG_Context_create() Failed to create Mercury client context"); ADAFS_DATA->spdlogger()->error("HG_Context_create() Failed to create Mercury client context"); HG_Finalize(hg_class); return false; } Loading Loading
lfs/src/classes/fs_data.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -142,14 +142,22 @@ void FsData::inode_count(fuse_ino_t inode_count) { FsData::inode_count_ = inode_count; } const std::vector<std::string>& FsData::hosts() const { const std::map<std::string, unsigned int>& FsData::hosts() const { return hosts_; } void FsData::hosts(const std::vector<std::string>& hosts) { void FsData::hosts(const std::map<std::string, unsigned int>& hosts) { FsData::hosts_ = hosts; } const std::string& FsData::hostname() const { return hostname_; } unsigned long FsData::hostname(const std::string& hostname) { FsData::hostname_ = hostname; return hostname.size(); } // Utility member functions fuse_ino_t FsData::raise_inode_count(fuse_ino_t count) { Loading @@ -160,3 +168,4 @@ fuse_ino_t FsData::raise_inode_count(fuse_ino_t count) {
lfs/src/classes/fs_data.hpp +10 −3 Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ #define LFS_FS_DATA_H #include "../main.hpp" #include <map> class FsData { Loading Loading @@ -33,7 +35,8 @@ private: std::string mgmt_path_; // hosts_ std::vector<std::string> hosts_; std::map<std::string, unsigned int> hosts_; std::string hostname_; // rocksdb std::shared_ptr<rocksdb::DB> rdb_; Loading Loading @@ -128,9 +131,13 @@ public: void rdb_write_options(const rocksdb::WriteOptions& rdb_write_options); const std::vector<std::string>& hosts() const; const std::map<std::string, unsigned int>& hosts() const; void hosts(const std::map<std::string, unsigned int>& hosts); const std::string& hostname() const; void hosts(const std::vector<std::string>& hosts); unsigned long hostname(const std::string& hostname); // Utility member functions Loading
lfs/src/main.cpp +13 −4 Original line number Diff line number Diff line #include <future> #include "main.hpp" #include <future> #include "classes/metadata.hpp" #include "adafs_ops/mdata_ops.hpp" #include "adafs_ops/dentry_ops.hpp" Loading @@ -14,7 +14,7 @@ using namespace std; namespace po = boost::program_options; struct tmp_fuse_usr { std::vector<std::string> hosts; std::map<std::string, unsigned int> hosts; std::string hostfile; }; Loading Loading @@ -42,6 +42,7 @@ void init_rpc_env(promise<bool> rpc_promise) { rpc_promise.set_value(true); margo_wait_for_finalize(mid); } /** * Initialize filesystem * Loading @@ -65,6 +66,12 @@ void adafs_ll_init(void* pdata, struct fuse_conn_info* conn) { auto fuse_data = static_cast<tmp_fuse_usr*>(pdata); ADAFS_DATA->hosts(fuse_data->hosts); auto hostname_size = ADAFS_DATA->hostname(Util::get_my_hostname()); if (hostname_size == 0) { ADAFS_DATA->spdlogger()->error("Unable to read the machine's hostname"); assert(hostname_size != 0); } // Make sure directory structure exists bfs::create_directories(ADAFS_DATA->dentry_path()); bfs::create_directories(ADAFS_DATA->inode_path()); Loading Loading @@ -200,7 +207,7 @@ void err_cleanup3(fuse_session& se) { * @param argv * @return */ int main(int argc, char* argv[]) { int main(int argc, const char* argv[]) { //Initialize the mapping of Fuse functions init_adafs_ops(&adafs_ops); Loading Loading @@ -258,10 +265,12 @@ int main(int argc, char* argv[]) { // XXX Hostfile parsing here... if (vm.count("hosts")) { auto hosts = vm["hosts"].as<string>(); unsigned int i = 0; // split comma separated host string boost::tokenizer<> tok(hosts); for (auto&& s : tok) { fuse_struct->hosts.push_back(s); fuse_struct->hosts[s] = i; i++; } } Loading
lfs/src/main.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,8 @@ namespace Util { int read_inode_cnt(); int write_inode_cnt(); std::string get_my_hostname(); } #endif //MAIN_H
lfs/src/rpc/rpc_util.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -19,13 +19,13 @@ bool init_argobots() { // We need no arguments to init auto argo_err = ABT_init(0, nullptr); if (argo_err != 0) { ADAFS_DATA->spdlogger()->info("[ERR]: ABT_init() Failed to init Argobots (client)"); ADAFS_DATA->spdlogger()->error("ABT_init() Failed to init Argobots (client)"); return false; } // Set primary execution stream to idle without polling. Normally xstreams cannot sleep. This is what ABT_snoozer does argo_err = ABT_snoozer_xstream_self_set(); if (argo_err != 0) { ADAFS_DATA->spdlogger()->info("[ERR]: ABT_snoozer_xstream_self_set() (client)"); ADAFS_DATA->spdlogger()->error("ABT_snoozer_xstream_self_set() (client)"); return false; } ADAFS_DATA->spdlogger()->info("Success."); Loading @@ -41,7 +41,7 @@ void destroy_argobots() { if (ret == ABT_SUCCESS) { ADAFS_DATA->spdlogger()->info("Argobots successfully shutdown."); } else { ADAFS_DATA->spdlogger()->info("Argobots shutdown FAILED with err code {}", ret); ADAFS_DATA->spdlogger()->error("Argobots shutdown FAILED with err code {}", ret); } } Loading @@ -66,13 +66,13 @@ bool init_rpc_server() { // Init Mercury layer (must be finalized when finished) hg_class = HG_Init(protocol_port.c_str(), HG_TRUE); if (hg_class == nullptr) { ADAFS_DATA->spdlogger()->info("[ERR]: HG_Init() Failed to init Mercury server layer"); ADAFS_DATA->spdlogger()->error("HG_Init() Failed to init Mercury server layer"); return false; } // Create a new Mercury context (must be destroyed when finished) hg_context = HG_Context_create(hg_class); if (hg_context == nullptr) { ADAFS_DATA->spdlogger()->info("[ERR]: HG_Context_create() Failed to create Mercury server context"); ADAFS_DATA->spdlogger()->error("HG_Context_create() Failed to create Mercury server context"); HG_Finalize(hg_class); return false; } Loading @@ -80,7 +80,7 @@ bool init_rpc_server() { // Figure out what address this server is listening on (must be freed when finished) auto hg_ret = HG_Addr_self(hg_class, &addr_self); if (hg_ret != HG_SUCCESS) { ADAFS_DATA->spdlogger()->info("[ERR]: HG_Addr_self() Failed to retrieve server address"); ADAFS_DATA->spdlogger()->error("HG_Addr_self() Failed to retrieve server address"); HG_Context_destroy(hg_context); HG_Finalize(hg_class); return false; Loading @@ -88,7 +88,7 @@ bool init_rpc_server() { // Convert the address to a cstring (with \0 terminator). hg_ret = HG_Addr_to_string(hg_class, addr_self_cstring, &addr_self_cstring_sz, addr_self); if (hg_ret != HG_SUCCESS) { ADAFS_DATA->spdlogger()->info("[ERR]: HG_Addr_to_string Failed to convert address to cstring"); ADAFS_DATA->spdlogger()->error("HG_Addr_to_string Failed to convert address to cstring"); HG_Context_destroy(hg_context); HG_Finalize(hg_class); HG_Addr_free(hg_class, addr_self); Loading @@ -103,7 +103,7 @@ bool init_rpc_server() { // Start Margo auto mid = margo_init(0, 0, hg_context); if (mid == MARGO_INSTANCE_NULL) { ADAFS_DATA->spdlogger()->info("[ERR]: margo_init failed to initialize the Margo server"); ADAFS_DATA->spdlogger()->error("margo_init failed to initialize the Margo server"); HG_Context_destroy(hg_context); HG_Finalize(hg_class); return false; Loading Loading @@ -148,13 +148,13 @@ bool init_rpc_client() { hg_context_t* hg_context; hg_class = HG_Init(protocol_port.c_str(), HG_FALSE); if (hg_class == nullptr) { ADAFS_DATA->spdlogger()->info("[ERR]: HG_Init() Failed to init Mercury client layer"); ADAFS_DATA->spdlogger()->error("HG_Init() Failed to init Mercury client layer"); return false; } // Create a new Mercury context (must be destroyed when finished) hg_context = HG_Context_create(hg_class); if (hg_context == nullptr) { ADAFS_DATA->spdlogger()->info("[ERR]: HG_Context_create() Failed to create Mercury client context"); ADAFS_DATA->spdlogger()->error("HG_Context_create() Failed to create Mercury client context"); HG_Finalize(hg_class); return false; } Loading