Loading lfs/CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -84,4 +84,4 @@ target_link_libraries(adafs ${FUSE3_LIBRARIES} ${ROCKSDB_LIBRARIES} ${snappy_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${ZSTD_LIBRARIES} ${gflags_LIBRARIES} ${LZ4_LIBRARY} # margo libs ${CCI_LIBRARIES} ${MERCURY_LIBRARIES} ${MERCURY_UTIL_LIBRARIES} ${ABT_LIBRARIES} ${ABT_SNOOZER_LIBRARIES} ${ABT_IO_LIBRARIES} ${MARGO_LIBRARIES} -lpthread -lboost_system -lboost_filesystem -lboost_serialization -pg) -lpthread -lboost_system -lboost_filesystem -lboost_serialization -lboost_program_options -pg) lfs/src/classes/fs_data.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,14 @@ void FsData::inode_count(fuse_ino_t inode_count) { FsData::inode_count_ = inode_count; } const std::vector<std::string>& FsData::hosts() const { return hosts_; } void FsData::hosts(const std::vector<std::string>& hosts) { FsData::hosts_ = hosts; } // Utility member functions fuse_ino_t FsData::raise_inode_count(fuse_ino_t count) { Loading @@ -150,3 +158,5 @@ fuse_ino_t FsData::raise_inode_count(fuse_ino_t count) { } lfs/src/classes/fs_data.hpp +7 −3 Original line number Diff line number Diff line Loading @@ -32,6 +32,9 @@ private: std::string chunk_path_; std::string mgmt_path_; // hosts_ std::vector<std::string> hosts_; // rocksdb std::shared_ptr<rocksdb::DB> rdb_; std::shared_ptr<rocksdb::DB> rdb_crt_; // additional db instance (currently not used) Loading @@ -46,9 +49,6 @@ public: // mutex has a deleted method to assign an existing mutex. As such it cannot use getter or setters std::mutex inode_mutex; std::mutex m; std::condition_variable cv; static FsData* getInstance() { static FsData instance; Loading Loading @@ -128,6 +128,10 @@ public: void rdb_write_options(const rocksdb::WriteOptions& rdb_write_options); const std::vector<std::string>& hosts() const; void hosts(const std::vector<std::string>& hosts); // Utility member functions fuse_ino_t raise_inode_count(fuse_ino_t count); Loading lfs/src/main.cpp +67 −9 Original line number Diff line number Diff line Loading @@ -11,6 +11,12 @@ static struct fuse_lowlevel_ops adafs_ops; using namespace std; namespace po = boost::program_options; struct tmp_fuse_usr { std::vector<std::string> hosts; std::string hostfile; }; /** * Initializes the rpc environment: Mercury with Argobots = Margo Loading Loading @@ -53,8 +59,12 @@ void init_rpc_env(promise<bool> rpc_promise) { * @param userdata the user data passed to fuse_session_new() */ void adafs_ll_init(void* pdata, struct fuse_conn_info* conn) { ADAFS_DATA->spdlogger()->info("adafs_ll_init() enter"s); // parse additional arguments to adafs auto fuse_data = static_cast<tmp_fuse_usr*>(pdata); ADAFS_DATA->hosts(fuse_data->hosts); // Make sure directory structure exists bfs::create_directories(ADAFS_DATA->dentry_path()); bfs::create_directories(ADAFS_DATA->inode_path()); Loading Loading @@ -209,12 +219,60 @@ int main(int argc, char* argv[]) { #else spdlog::set_level(spdlog::level::off); #endif //extract the rootdir from argv and put it into rootdir of adafs_data // TODO pointer modification = dangerous. need another solution ADAFS_DATA->rootdir(string(realpath(argv[argc - 2], nullptr))); argv[argc - 2] = argv[argc - 1]; argv[argc - 1] = nullptr; argc--; // Parse input auto fuse_argc = 1; vector<string> fuse_argv; fuse_argv.push_back(move(argv[0])); auto fuse_struct = make_unique<tmp_fuse_usr>(); po::options_description desc("Allowed options"); desc.add_options() ("help,h", "Help message") ("foreground,f", "Run Fuse instance in foreground. (Fuse parameter)") ("mountdir,m", po::value<string>(), "User Fuse mountdir. (Fuse parameter)") ("rootdir,r", po::value<string>(), "ADA-FS data directory") ("hostsfile", po::value<string>(), "Path to the hosts_ file for all fs participants") ("hosts,h", po::value<string>(), "Comma separated list of hosts_ for all fs participants"); po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm); if (vm.count("help")) { cout << desc << "\n"; return 1; } if (vm.count("foreground")) { fuse_argc++; fuse_argv.push_back("-f"s); } if (vm.count("mountdir")) { fuse_argc++; fuse_argv.push_back(vm["mountdir"].as<string>()); } if (vm.count("rootdir")) { ADAFS_DATA->rootdir(vm["rootdir"].as<string>()); } // XXX Hostfile parsing here... if (vm.count("hosts")) { auto hosts = vm["hosts"].as<string>(); // split comma separated host string boost::tokenizer<> tok(hosts); for (auto&& s : tok) { fuse_struct->hosts.push_back(s); } } // convert fuse_argv into char* [] char* fuse_argv_c[10] = {0}; for (unsigned int i = 0; i < fuse_argv.size(); ++i) { char* tmp_c = new char[fuse_argv[i].size() + 1]; std::strcpy(tmp_c, fuse_argv[i].c_str()); fuse_argv_c[i] = tmp_c; } //set all paths ADAFS_DATA->inode_path(ADAFS_DATA->rootdir() + "/meta/inodes"s); ADAFS_DATA->dentry_path(ADAFS_DATA->rootdir() + "/meta/dentries"s); Loading @@ -222,7 +280,7 @@ int main(int argc, char* argv[]) { ADAFS_DATA->mgmt_path(ADAFS_DATA->rootdir() + "/mgmt"s); // Fuse stuff starts here in C style... ######################################################################## struct fuse_args args = FUSE_ARGS_INIT(argc, argv); struct fuse_args args = FUSE_ARGS_INIT(fuse_argc, fuse_argv_c); struct fuse_session* se; struct fuse_cmdline_opts opts; int err = -1; Loading @@ -243,7 +301,7 @@ int main(int argc, char* argv[]) { } // creating a low level session se = fuse_session_new(&args, &adafs_ops, sizeof(adafs_ops), nullptr); se = fuse_session_new(&args, &adafs_ops, sizeof(adafs_ops), fuse_struct.get()); if (se == NULL) { err_cleanup1(opts, args); Loading lfs/src/main.hpp +2 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ extern "C" { // boost libs #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> #include <boost/program_options.hpp> #include <boost/tokenizer.hpp> // adafs #include "configure.hpp" // third party libs Loading @@ -40,8 +42,6 @@ extern "C" { #include <mercury.h> } #include <condition_variable> // classes #include "classes/fs_data.hpp" #include "classes/rpc_data.hpp" Loading Loading
lfs/CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -84,4 +84,4 @@ target_link_libraries(adafs ${FUSE3_LIBRARIES} ${ROCKSDB_LIBRARIES} ${snappy_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${ZSTD_LIBRARIES} ${gflags_LIBRARIES} ${LZ4_LIBRARY} # margo libs ${CCI_LIBRARIES} ${MERCURY_LIBRARIES} ${MERCURY_UTIL_LIBRARIES} ${ABT_LIBRARIES} ${ABT_SNOOZER_LIBRARIES} ${ABT_IO_LIBRARIES} ${MARGO_LIBRARIES} -lpthread -lboost_system -lboost_filesystem -lboost_serialization -pg) -lpthread -lboost_system -lboost_filesystem -lboost_serialization -lboost_program_options -pg)
lfs/src/classes/fs_data.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,14 @@ void FsData::inode_count(fuse_ino_t inode_count) { FsData::inode_count_ = inode_count; } const std::vector<std::string>& FsData::hosts() const { return hosts_; } void FsData::hosts(const std::vector<std::string>& hosts) { FsData::hosts_ = hosts; } // Utility member functions fuse_ino_t FsData::raise_inode_count(fuse_ino_t count) { Loading @@ -150,3 +158,5 @@ fuse_ino_t FsData::raise_inode_count(fuse_ino_t count) { }
lfs/src/classes/fs_data.hpp +7 −3 Original line number Diff line number Diff line Loading @@ -32,6 +32,9 @@ private: std::string chunk_path_; std::string mgmt_path_; // hosts_ std::vector<std::string> hosts_; // rocksdb std::shared_ptr<rocksdb::DB> rdb_; std::shared_ptr<rocksdb::DB> rdb_crt_; // additional db instance (currently not used) Loading @@ -46,9 +49,6 @@ public: // mutex has a deleted method to assign an existing mutex. As such it cannot use getter or setters std::mutex inode_mutex; std::mutex m; std::condition_variable cv; static FsData* getInstance() { static FsData instance; Loading Loading @@ -128,6 +128,10 @@ public: void rdb_write_options(const rocksdb::WriteOptions& rdb_write_options); const std::vector<std::string>& hosts() const; void hosts(const std::vector<std::string>& hosts); // Utility member functions fuse_ino_t raise_inode_count(fuse_ino_t count); Loading
lfs/src/main.cpp +67 −9 Original line number Diff line number Diff line Loading @@ -11,6 +11,12 @@ static struct fuse_lowlevel_ops adafs_ops; using namespace std; namespace po = boost::program_options; struct tmp_fuse_usr { std::vector<std::string> hosts; std::string hostfile; }; /** * Initializes the rpc environment: Mercury with Argobots = Margo Loading Loading @@ -53,8 +59,12 @@ void init_rpc_env(promise<bool> rpc_promise) { * @param userdata the user data passed to fuse_session_new() */ void adafs_ll_init(void* pdata, struct fuse_conn_info* conn) { ADAFS_DATA->spdlogger()->info("adafs_ll_init() enter"s); // parse additional arguments to adafs auto fuse_data = static_cast<tmp_fuse_usr*>(pdata); ADAFS_DATA->hosts(fuse_data->hosts); // Make sure directory structure exists bfs::create_directories(ADAFS_DATA->dentry_path()); bfs::create_directories(ADAFS_DATA->inode_path()); Loading Loading @@ -209,12 +219,60 @@ int main(int argc, char* argv[]) { #else spdlog::set_level(spdlog::level::off); #endif //extract the rootdir from argv and put it into rootdir of adafs_data // TODO pointer modification = dangerous. need another solution ADAFS_DATA->rootdir(string(realpath(argv[argc - 2], nullptr))); argv[argc - 2] = argv[argc - 1]; argv[argc - 1] = nullptr; argc--; // Parse input auto fuse_argc = 1; vector<string> fuse_argv; fuse_argv.push_back(move(argv[0])); auto fuse_struct = make_unique<tmp_fuse_usr>(); po::options_description desc("Allowed options"); desc.add_options() ("help,h", "Help message") ("foreground,f", "Run Fuse instance in foreground. (Fuse parameter)") ("mountdir,m", po::value<string>(), "User Fuse mountdir. (Fuse parameter)") ("rootdir,r", po::value<string>(), "ADA-FS data directory") ("hostsfile", po::value<string>(), "Path to the hosts_ file for all fs participants") ("hosts,h", po::value<string>(), "Comma separated list of hosts_ for all fs participants"); po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm); if (vm.count("help")) { cout << desc << "\n"; return 1; } if (vm.count("foreground")) { fuse_argc++; fuse_argv.push_back("-f"s); } if (vm.count("mountdir")) { fuse_argc++; fuse_argv.push_back(vm["mountdir"].as<string>()); } if (vm.count("rootdir")) { ADAFS_DATA->rootdir(vm["rootdir"].as<string>()); } // XXX Hostfile parsing here... if (vm.count("hosts")) { auto hosts = vm["hosts"].as<string>(); // split comma separated host string boost::tokenizer<> tok(hosts); for (auto&& s : tok) { fuse_struct->hosts.push_back(s); } } // convert fuse_argv into char* [] char* fuse_argv_c[10] = {0}; for (unsigned int i = 0; i < fuse_argv.size(); ++i) { char* tmp_c = new char[fuse_argv[i].size() + 1]; std::strcpy(tmp_c, fuse_argv[i].c_str()); fuse_argv_c[i] = tmp_c; } //set all paths ADAFS_DATA->inode_path(ADAFS_DATA->rootdir() + "/meta/inodes"s); ADAFS_DATA->dentry_path(ADAFS_DATA->rootdir() + "/meta/dentries"s); Loading @@ -222,7 +280,7 @@ int main(int argc, char* argv[]) { ADAFS_DATA->mgmt_path(ADAFS_DATA->rootdir() + "/mgmt"s); // Fuse stuff starts here in C style... ######################################################################## struct fuse_args args = FUSE_ARGS_INIT(argc, argv); struct fuse_args args = FUSE_ARGS_INIT(fuse_argc, fuse_argv_c); struct fuse_session* se; struct fuse_cmdline_opts opts; int err = -1; Loading @@ -243,7 +301,7 @@ int main(int argc, char* argv[]) { } // creating a low level session se = fuse_session_new(&args, &adafs_ops, sizeof(adafs_ops), nullptr); se = fuse_session_new(&args, &adafs_ops, sizeof(adafs_ops), fuse_struct.get()); if (se == NULL) { err_cleanup1(opts, args); Loading
lfs/src/main.hpp +2 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ extern "C" { // boost libs #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> #include <boost/program_options.hpp> #include <boost/tokenizer.hpp> // adafs #include "configure.hpp" // third party libs Loading @@ -40,8 +42,6 @@ extern "C" { #include <mercury.h> } #include <condition_variable> // classes #include "classes/fs_data.hpp" #include "classes/rpc_data.hpp" Loading