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

Bug Solves (finishing gekkofs, corrupts hosts list)

parent ce0df018
Loading
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ public:
        : m_path(std::move(filepath)) {}

    file(std::filesystem::path filepath, int fd,
         std::unique_ptr<cargo::FSPlugin> fs_plugin) noexcept
         std::shared_ptr<cargo::FSPlugin> fs_plugin) noexcept
        : m_path(std::move(filepath)), m_handle(fd),
          m_fs_plugin(std::move(fs_plugin)) {}

@@ -203,6 +203,11 @@ public:
        }
    }

    void
    close() noexcept {
        m_fs_plugin->close(m_handle.native());
    }

    template <typename MemoryBuffer>
    std::size_t
    pread(MemoryBuffer&& buf, offset offset, std::size_t size) const {
@@ -284,7 +289,7 @@ public:
protected:
    const std::filesystem::path m_path;
    file_handle m_handle;
    std::unique_ptr<cargo::FSPlugin> m_fs_plugin;
    std::shared_ptr<cargo::FSPlugin> m_fs_plugin;
};


@@ -292,7 +297,7 @@ static inline file
open(const std::filesystem::path& filepath, int flags, ::mode_t mode,
     cargo::FSPlugin::type t) {

    std::unique_ptr<cargo::FSPlugin> fs_plugin;
    std::shared_ptr<cargo::FSPlugin> fs_plugin;

    fs_plugin = cargo::FSPlugin::make_fs(t);
    // We don't check if it exists, we just create it if flags is set to O_CREAT
+7 −3
Original line number Diff line number Diff line
@@ -9,14 +9,18 @@ gekko_plugin::gekko_plugin() {
    int result = gkfs_init();
    if(result != 0) {
        std::cerr << "Failed to initialize gekkofs" << std::endl;
    }  else {
        std::cout << "Initialized gekkofs" << std::endl;
    }
}

gekko_plugin::~gekko_plugin() {
    int result = gkfs_end();
    /*int result = gkfs_end();
    if(result != 0) {
        std::cerr << "Failed to finalize gekkofs" << std::endl;
    }
    } else {
        std::cout << "Finalized gekkofs" << std::endl;
    }*/
}
// Override the open function
int
+5 −1
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ mpio_read::operator()() {
    using posix_file::views::strided;
    m_status = error_code::transfer_in_progress;
    try {
        
        const auto input_file = mpioxx::file::open(
                m_workers, m_input_path, mpioxx::file_open_mode::rdonly);

@@ -179,8 +180,10 @@ mpio_read::progress(int ongoing_index) {
                    return index;
                }
            }
            // LOG indexes and sizes
        
            assert(m_buffer_regions[index].size() >= file_range.size());
           
            auto start = std::chrono::steady_clock::now();
            m_output_file->pwrite(m_buffer_regions[index], file_range.offset(),
                                  file_range.size());
@@ -221,6 +224,7 @@ mpio_read::progress(int ongoing_index) {
    }

    m_status = error_code::success;
    m_output_file->close();
    return -1;
}