Commit deb6d496 authored by Ramon Nou's avatar Ramon Nou
Browse files

SC changes

parent 68a06fa8
Loading
Loading
Loading
Loading
Compare 0af45bfa to afd0ac5a
Original line number Diff line number Diff line
Subproject commit 0af45bfa667f7ff9c78167ef94d975bffbd879f0
Subproject commit afd0ac5ad785250da1eab9061f59deef9416d565
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ namespace gkfs {
namespace syscall {

int gkfs_open(const std::string& path, mode_t mode, int flags);

int gkfs_close(const unsigned int fd); 
int gkfs_create(const std::string& path, mode_t mode);

int gkfs_remove(const std::string& path);
+5 −5
Original line number Diff line number Diff line
@@ -45,27 +45,27 @@ constexpr auto daemon_log_level = 4; //info
namespace metadata {
// which metadata should be considered apart from size and mode
constexpr auto use_atime = false;
constexpr auto use_ctime = false;
constexpr auto use_ctime = true;
constexpr auto use_mtime = false;
constexpr auto use_link_cnt = false;
constexpr auto use_blocks = false;

// metadata logic
// Check for existence of file metadata before create. This done on RocksDB level
constexpr auto create_exist_check = true;
constexpr auto create_exist_check = false;
} // namespace metadata

namespace rpc {
constexpr auto chunksize = 524288; // in bytes (e.g., 524288 == 512KB)
//size of preallocated buffer to hold directory entries in rpc call
constexpr auto dirents_buff_size = (8 * 1024 * 1024); // 8 mega
constexpr auto dirents_buff_size = (2000 * 1024 * 1024); // 8 mega
/*
 * Indicates the number of concurrent progress to drive I/O operations of chunk files to and from local file systems
 * The value is directly mapped to created Argobots xstreams, controlled in a single pool with ABT_snoozer scheduler
 */
constexpr auto daemon_io_xstreams = 8;
constexpr auto daemon_io_xstreams = 6;
// Number of threads used for RPC handlers at the daemon
constexpr auto daemon_handler_xstreams = 8;
constexpr auto daemon_handler_xstreams = 6;
} // namespace rpc

namespace rocksdb {
+48 −6
Original line number Diff line number Diff line
@@ -101,7 +101,6 @@ namespace syscall {
 * @return 0 on success, -1 on failure
 */
int gkfs_open(const std::string& path, mode_t mode, int flags) {

    if (flags & O_PATH) {
        LOG(ERROR, "`O_PATH` flag is not supported");
        errno = ENOTSUP;
@@ -183,7 +182,6 @@ int gkfs_open(const std::string& path, mode_t mode, int flags) {
            return -1;
        }
}    

return CTX->file_map()->add(std::make_shared<gkfs::filemap::OpenFile>(path, flags));
}

@@ -547,6 +545,7 @@ int gkfs_dup(const int oldfd) {
}

/**
 *
 * gkfs wrapper for dup2() system calls
 * errno may be set
 * @param oldfd
@@ -556,7 +555,6 @@ int gkfs_dup(const int oldfd) {
int gkfs_dup2(const int oldfd, const int newfd) {
    return CTX->file_map()->dup2(oldfd, newfd);
}

/**
 * Wrapper function for all gkfs write operations
 * errno may be set
@@ -566,6 +564,9 @@ int gkfs_dup2(const int oldfd, const int newfd) {
 * @param offset
 * @return written size or -1 on error
 */
static unsigned long long shared_file_size;
static std::mutex close_lock;

ssize_t gkfs_pwrite(std::shared_ptr<gkfs::filemap::OpenFile> file, const char* buf, size_t count, off64_t offset) {
    if (file->type() != gkfs::filemap::FileType::regular) {
        assert(file->type() == gkfs::filemap::FileType::directory);
@@ -575,6 +576,27 @@ ssize_t gkfs_pwrite(std::shared_ptr<gkfs::filemap::OpenFile> file, const char* b
    }
    auto path = make_shared<string>(file->path());
    auto append_flag = file->get_flag(gkfs::filemap::OpenFile_flags::append);
if ((*path)[1] != 'm' /*== "/ior-hard/file"s*/)
{
    close_lock.lock(); 
    //if (shared_file_size < ((unsigned long long)offset+(unsigned long long)count))  
   // shared_file_size = gkfs::rpc::forward_update_metadentry_size(*path, count, (unsigned long long)offset, append_flag).second;
    shared_file_size = max((unsigned long long)shared_file_size, (unsigned long long)count+(unsigned long long)offset);
    close_lock.unlock();
    auto updated_size = shared_file_size;

    auto ret_write = gkfs::rpc::forward_write(*path, buf, append_flag, offset, count, updated_size);
    auto err = ret_write.first;
    if (err) {
        LOG(WARNING, "gkfs::rpc::forward_write() failed with err '{}'", err);
        errno = err;
        return -1;
    }
    return ret_write.second; // return written size



}

    auto ret_update_size = gkfs::rpc::forward_update_metadentry_size(*path, count, offset, append_flag);
    auto err = ret_update_size.first;
@@ -595,6 +617,26 @@ ssize_t gkfs_pwrite(std::shared_ptr<gkfs::filemap::OpenFile> file, const char* b
    return ret_write.second; // return written size
}




int gkfs_close(unsigned int fd){
auto file = CTX->file_map()->get(fd);
auto pathx = make_shared<string>(file->path());
if ((*pathx)[1] != 'm' /* == "/ior-hard/file"s*/)
{
 close_lock.lock();
if(shared_file_size > 0)
{
	gkfs::rpc::forward_update_metadentry_size(*pathx, shared_file_size, 0, false);
	shared_file_size =0;
}
 close_lock.unlock();
}

return 0;
}

/**
 * gkfs wrapper for pwrite() system calls
 * errno may be set
+1 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ int hook_close(int fd) {

    if (CTX->file_map()->exist(fd)) {
        // No call to the daemon is required
	gkfs::syscall::gkfs_close(fd);
        CTX->file_map()->remove(fd);
        return 0;
    }
Loading