Commit 02e3b066 authored by Marc Vef's avatar Marc Vef
Browse files

ifs: Migrating rpc client to preload library (WIP)

parent ec5b79bc
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -53,9 +53,10 @@ set(SOURCE_FILES main.cpp main.hpp configure.hpp util.cpp

        src/daemon/fs_operations.cpp src/daemon/fs_operations.cpp include/daemon/fs_operations.hpp src/adafs_ops/metadentry.cpp
        include/adafs_ops/metadentry.hpp src/db/db_ops.cpp src/db/db_ops.cpp include/db/db_ops.hpp
        src/rpc/handler/h_metadentry.cpp src/rpc/sender/c_metadentry.cpp include/rpc/sender/c_metadentry.hpp
        src/adafs_ops/data.cpp include/adafs_ops/data.hpp src/rpc/handler/h_data.cpp src/rpc/sender/c_data.cpp
        include/rpc/sender/c_data.hpp src/rpc/handler/h_preload.cpp)
        src/rpc/handler/h_metadentry.cpp
        src/adafs_ops/data.cpp include/adafs_ops/data.hpp src/rpc/handler/h_data.cpp
        src/rpc/handler/h_preload.cpp
        )
add_executable(adafs_daemon ${SOURCE_FILES})
target_link_libraries(adafs_daemon ${ROCKSDB_LIBRARIES}
        # rocksdb libs
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@

// Enable logging for daemon
#define LOG_PRELOAD_DEBUG 1
#define LOG_PRELOAD_TRACE 1
#define LOG_PRELOAD_PATH "/tmp/adafs_preload.log"

// If ACM time should be considered
+5 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ private:
    std::string mgmt_path_;

    // hosts_
    std::string hosts_raw_; // raw hosts string, given when daemon is started. Used to give it to fs client
    std::map<uint64_t, std::string> hosts_;
    uint64_t host_id_; // my host number
    size_t host_size_;
@@ -157,6 +158,10 @@ public:

    void rdb_write_options(const rocksdb::WriteOptions& rdb_write_options);

    const std::string& hosts_raw() const;

    void hosts_raw(const std::string& hosts_raw);

    const std::map<uint64_t, std::string>& hosts() const;

    void hosts(const std::map<uint64_t, std::string>& hosts);
+5 −2
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ MERCURY_GEN_PROC(ipc_res_out_t, ((hg_bool_t) (res))) // generic return type
//
//MERCURY_GEN_PROC(rpc_minimal_out_tt, ((int32_t) (output)))

MERCURY_GEN_PROC(ipc_config_in_t, ((int32_t) (dummy)))
MERCURY_GEN_PROC(ipc_config_in_t, ((int32_t) (dummy))) // XXX remove that.

MERCURY_GEN_PROC(ipc_config_out_t, ((hg_const_string_t) (mountdir))
        ((hg_const_string_t) (rootdir)) \
@@ -26,7 +26,10 @@ MERCURY_GEN_PROC(ipc_config_out_t, ((hg_const_string_t) (mountdir))
((hg_bool_t) (link_cnt_state)) \
((hg_bool_t) (blocks_state)) \
((hg_uint32_t) (uid)) \
((hg_uint32_t) (gid)))
((hg_uint32_t) (gid)) \
((hg_const_string_t) (hosts_raw)) \
((hg_uint64_t) (host_id)) \
((hg_uint64_t) (host_size)))


MERCURY_GEN_PROC(ipc_open_in_t, ((hg_const_string_t) (path))
+27 −4
Original line number Diff line number Diff line
@@ -40,15 +40,30 @@ struct FsConfig {

    std::string mountdir;
    std::string rootdir;

    // rpc infos
    std::map<uint64_t, std::string> hosts;
    uint64_t host_id; // my host number
    size_t host_size;
    std::string rpc_port;
};
// fs_config is set ONCE in the beginning. It shall not be modified afterwards
extern shared_ptr<struct FsConfig> fs_config;

extern FILE* debug_fd;

#define DAEMON_DEBUG(fd, fmt, ...) \
            do { if (LOG_PRELOAD_DEBUG) fprintf(fd, "[" __DATE__ ":" __TIME__ "] " fmt, ##__VA_ARGS__); fflush(fd); } while (0)
#define DAEMON_DEBUG0(fd, fmt) \
            do { if (LOG_PRELOAD_DEBUG) fprintf(fd, "[" __DATE__ ":" __TIME__ "] " fmt); fflush(fd); } while (0)
#define LD_LOG_DEBUG(fd, fmt, ...) \
            do { if (LOG_PRELOAD_DEBUG) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [debug]" fmt, ##__VA_ARGS__); fflush(fd); } while (0)
#define LD_LOG_TRACE(fd, fmt, ...) \
            do { if (LOG_PRELOAD_TRACE) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [debug]" fmt, ##__VA_ARGS__); fflush(fd); } while (0)
#define LD_LOG_ERROR(fd, fmt, ...) \
            do { fprintf(fd, "[" __DATE__ ":" __TIME__ "] [err]" fmt, ##__VA_ARGS__); fflush(fd); } while (0)
#define LD_LOG_DEBUG0(fd, fmt) \
            do { if (LOG_PRELOAD_DEBUG) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [debug]" fmt); fflush(fd); } while (0)
#define LD_LOG_TRACE0(fd, fmt) \
            do { if (LOG_PRELOAD_TRACE) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [debug]" fmt); fflush(fd); } while (0)
#define LD_LOG_ERROR0(fd, fmt) \
            do { fprintf(fd, "[" __DATE__ ":" __TIME__ "] [err]" fmt); fflush(fd); } while (0)


bool init_ld_argobots();
@@ -63,8 +78,16 @@ hg_context_t* ld_mercury_ipc_context();

margo_instance_id ld_margo_ipc_id();

margo_instance_id ld_margo_rpc_id();

hg_addr_t daemon_addr();

bool get_addr_by_hostid(const uint64_t hostid, hg_addr_t& svr_addr);

size_t get_rpc_node(const std::string& to_hash);

bool is_local_op(const size_t recipient);

void init_passthrough_if_needed();

void init_preload(void) __attribute__((constructor));
Loading