Commit 5989e600 authored by Tommaso Tocci's avatar Tommaso Tocci
Browse files

Merge branch 'adafs_metadata' into 'master'

various metadata related improvements

See merge request zdvresearch_bsc/adafs!96
parents 13e811d7 2409ec6e
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@

int create_node(const std::string& path, const uid_t uid, const gid_t gid, mode_t mode);

void create_metadentry(const std::string& path, mode_t mode);
void create_metadentry(const std::string& path, Metadata& md);

std::string get_metadentry_str(const std::string& path);

+3 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
#define IFS_ADAFS_FUNCTIONS_HPP

#include <preload/open_file_map.hpp>

#include <global/metadata.hpp>
/*
 * See include/linux/statfs.h (not includable)
 *
@@ -26,6 +26,8 @@
#define ST_NODIRATIME    0x0800    /* do not update directory access times */
#define ST_RELATIME    0x1000    /* update atime relative to mtime/ctime */

std::shared_ptr<Metadata> adafs_metadata(const std::string& path);

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

int adafs_mk_node(const std::string& path, mode_t mode);
+2 −1
Original line number Diff line number Diff line
@@ -74,8 +74,9 @@ bool init_environment() {
    ADAFS_DATA->link_cnt_state(MDATA_USE_LINK_CNT);
    ADAFS_DATA->blocks_state(MDATA_USE_BLOCKS);
    // Create metadentry for root directory
    Metadata root_md{S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO};
    try {
        create_metadentry("/", S_IFDIR | 777);
        create_metadentry("/", root_md);
    } catch (const std::exception& e ) {
        ADAFS_DATA->spdlogger()->error("{}() Unable to write root metadentry to KV store: {}", __func__, e.what());
        return false;
+1 −2
Original line number Diff line number Diff line
@@ -16,9 +16,8 @@ ino_t generate_inode_no() {
 * @param path
 * @param mode
 */
void create_metadentry(const std::string& path, mode_t mode) {
void create_metadentry(const std::string& path, Metadata& md) {

    Metadata md{mode};
    // update metadata object based on what metadata is needed
    if (ADAFS_DATA->atime_state() || ADAFS_DATA->mtime_state() || ADAFS_DATA->ctime_state()) {
        std::time_t time;
+2 −1
Original line number Diff line number Diff line
@@ -43,9 +43,10 @@ static hg_return_t rpc_srv_mk_node(hg_handle_t handle) {
    assert(ret == HG_SUCCESS);
    ADAFS_DATA->spdlogger()->debug("{}() Got RPC (from local {}) with path {}", __func__,
                                   (margo_get_info(handle)->context_id == ADAFS_DATA->host_id()), in.path);
    Metadata md(in.mode);
    try {
        // create metadentry
        create_metadentry(in.path, in.mode);
        create_metadentry(in.path, md);
        out.err = 0;
    } catch (const std::exception& e) {
        ADAFS_DATA->spdlogger()->error("{}() Failed to create metadentry: {}",  __func__, e.what());
Loading