Loading lfs/clone_all.sh 100755 → 100644 +0 −0 File mode changed from 100755 to 100644. View file lfs/compile_all.sh 100755 → 100644 +0 −0 File mode changed from 100755 to 100644. View file lfs/src/adafs_ops/io.cpp +40 −1 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ // #include "io.hpp" #include "../classes/metadata.hpp" #include "mdata_ops.hpp" using namespace std; Loading Loading @@ -44,6 +46,15 @@ int destroy_chunk_space(const fuse_ino_t inode) { return 0; } /** * pread wrapper * @param buf * @param read_size * @param path * @param size * @param off * @return */ int read_file(char* buf, size_t& read_size, const char* path, const size_t size, const off_t off) { int fd = open(path, R_OK); if (fd < 0) Loading @@ -52,3 +63,31 @@ int read_file(char* buf, size_t& read_size, const char* path, const size_t size, close(fd); return 0; } int write_file(const fuse_ino_t inode, const char *buf, size_t &write_size, const size_t size, const off_t off, const bool append) { auto chnk_path = bfs::path(ADAFS_DATA->chunk_path()); chnk_path /= fmt::FormatInt(inode).c_str(); chnk_path /= "data"s; // write to local file int fd = open(chnk_path.c_str(), W_OK); if (fd < 0) return EIO; write_size = static_cast<size_t>(pwrite(fd, buf, size, off)); close(fd); // Depending on if the file was appended or not metadata sizes need to be modified accordingly if (append) { // appending requires to read the old size first so that the new size can be added to it Metadata md{}; read_metadata_field_md(inode, Md_fields::size, md); // truncating file truncate(chnk_path.c_str(), md.size() + size); // refresh metadata size field write_metadata_field(inode, Md_fields::size, md.size() + static_cast<off_t>(size)); } else { truncate(chnk_path.c_str(), size); write_metadata_field(inode, Md_fields::size, static_cast<off_t>(size)); } return 0; } lfs/src/adafs_ops/io.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -13,4 +13,8 @@ int destroy_chunk_space(const fuse_ino_t inode); int read_file(char* buf, size_t& read_size, const char* path, const size_t size, const off_t off); int write_file(const fuse_ino_t inode, const char *buf, size_t &write_size, const size_t size, const off_t off, const bool append); #endif //FS_IO_H lfs/src/classes/rpc_data.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -20,8 +20,10 @@ bool RPCData::get_addr_by_hostid(const uint64_t hostid, hg_addr_t& svr_addr) { auto hostname = "cci+tcp://" + ADAFS_DATA->hosts().at(hostid) + ":" + ADAFS_DATA->rpc_port(); // convert hostid to hostname and port #else auto hostname = "cci+tcp://134.93.182.11:" + auto hostname = "cci+tcp://127.0.0.1:" + ADAFS_DATA->rpc_port(); // convert hostid to hostname and port // auto hostname = "cci+tcp://134.93.182.11:" + // ADAFS_DATA->rpc_port(); // convert hostid to hostname and port #endif ADAFS_DATA->spdlogger()->debug("generated hostid {}", hostname); margo_addr_lookup(RPC_DATA->client_mid(), hostname.c_str(), &svr_addr); Loading Loading
lfs/src/adafs_ops/io.cpp +40 −1 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ // #include "io.hpp" #include "../classes/metadata.hpp" #include "mdata_ops.hpp" using namespace std; Loading Loading @@ -44,6 +46,15 @@ int destroy_chunk_space(const fuse_ino_t inode) { return 0; } /** * pread wrapper * @param buf * @param read_size * @param path * @param size * @param off * @return */ int read_file(char* buf, size_t& read_size, const char* path, const size_t size, const off_t off) { int fd = open(path, R_OK); if (fd < 0) Loading @@ -52,3 +63,31 @@ int read_file(char* buf, size_t& read_size, const char* path, const size_t size, close(fd); return 0; } int write_file(const fuse_ino_t inode, const char *buf, size_t &write_size, const size_t size, const off_t off, const bool append) { auto chnk_path = bfs::path(ADAFS_DATA->chunk_path()); chnk_path /= fmt::FormatInt(inode).c_str(); chnk_path /= "data"s; // write to local file int fd = open(chnk_path.c_str(), W_OK); if (fd < 0) return EIO; write_size = static_cast<size_t>(pwrite(fd, buf, size, off)); close(fd); // Depending on if the file was appended or not metadata sizes need to be modified accordingly if (append) { // appending requires to read the old size first so that the new size can be added to it Metadata md{}; read_metadata_field_md(inode, Md_fields::size, md); // truncating file truncate(chnk_path.c_str(), md.size() + size); // refresh metadata size field write_metadata_field(inode, Md_fields::size, md.size() + static_cast<off_t>(size)); } else { truncate(chnk_path.c_str(), size); write_metadata_field(inode, Md_fields::size, static_cast<off_t>(size)); } return 0; }
lfs/src/adafs_ops/io.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -13,4 +13,8 @@ int destroy_chunk_space(const fuse_ino_t inode); int read_file(char* buf, size_t& read_size, const char* path, const size_t size, const off_t off); int write_file(const fuse_ino_t inode, const char *buf, size_t &write_size, const size_t size, const off_t off, const bool append); #endif //FS_IO_H
lfs/src/classes/rpc_data.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -20,8 +20,10 @@ bool RPCData::get_addr_by_hostid(const uint64_t hostid, hg_addr_t& svr_addr) { auto hostname = "cci+tcp://" + ADAFS_DATA->hosts().at(hostid) + ":" + ADAFS_DATA->rpc_port(); // convert hostid to hostname and port #else auto hostname = "cci+tcp://134.93.182.11:" + auto hostname = "cci+tcp://127.0.0.1:" + ADAFS_DATA->rpc_port(); // convert hostid to hostname and port // auto hostname = "cci+tcp://134.93.182.11:" + // ADAFS_DATA->rpc_port(); // convert hostid to hostname and port #endif ADAFS_DATA->spdlogger()->debug("generated hostid {}", hostname); margo_addr_lookup(RPC_DATA->client_mid(), hostname.c_str(), &svr_addr); Loading