Merge pull request #229 from mchaarawi/fix-modules
update DFS and DAOS drivers to new aiori module interface.master
commit
825dcef337
200
src/aiori-DAOS.c
200
src/aiori-DAOS.c
|
@ -24,15 +24,16 @@
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include <mpi.h>
|
||||||
#include <gurt/common.h>
|
#include <gurt/common.h>
|
||||||
#include <daos.h>
|
#include <daos.h>
|
||||||
|
|
||||||
#include "ior.h"
|
|
||||||
#include "aiori.h"
|
#include "aiori.h"
|
||||||
|
#include "utilities.h"
|
||||||
#include "iordef.h"
|
#include "iordef.h"
|
||||||
|
|
||||||
/************************** O P T I O N S *****************************/
|
/************************** O P T I O N S *****************************/
|
||||||
struct daos_options{
|
typedef struct {
|
||||||
char *pool;
|
char *pool;
|
||||||
char *svcl;
|
char *svcl;
|
||||||
char *group;
|
char *group;
|
||||||
|
@ -40,49 +41,62 @@ struct daos_options{
|
||||||
int chunk_size;
|
int chunk_size;
|
||||||
int destroy;
|
int destroy;
|
||||||
char *oclass;
|
char *oclass;
|
||||||
};
|
} DAOS_options_t;
|
||||||
|
|
||||||
static struct daos_options o = {
|
static option_help * DAOS_options(aiori_mod_opt_t ** init_backend_options,
|
||||||
.pool = NULL,
|
aiori_mod_opt_t * init_values){
|
||||||
.svcl = NULL,
|
DAOS_options_t * o = malloc(sizeof(DAOS_options_t));
|
||||||
.group = NULL,
|
|
||||||
.cont = NULL,
|
|
||||||
.chunk_size = 1048576,
|
|
||||||
.destroy = 0,
|
|
||||||
.oclass = NULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
static option_help options [] = {
|
if (init_values != NULL) {
|
||||||
{0, "daos.pool", "pool uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o.pool},
|
memcpy(o, init_values, sizeof(DAOS_options_t));
|
||||||
{0, "daos.svcl", "pool SVCL", OPTION_OPTIONAL_ARGUMENT, 's', &o.svcl},
|
} else {
|
||||||
{0, "daos.group", "server group", OPTION_OPTIONAL_ARGUMENT, 's', &o.group},
|
memset(o, 0, sizeof(DAOS_options_t));
|
||||||
{0, "daos.cont", "container uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o.cont},
|
/* initialize the options properly */
|
||||||
{0, "daos.chunk_size", "chunk size", OPTION_OPTIONAL_ARGUMENT, 'd', &o.chunk_size},
|
o->chunk_size = 1048576;
|
||||||
{0, "daos.destroy", "Destroy Container", OPTION_FLAG, 'd', &o.destroy},
|
}
|
||||||
{0, "daos.oclass", "object class", OPTION_OPTIONAL_ARGUMENT, 's', &o.oclass},
|
|
||||||
LAST_OPTION
|
*init_backend_options = (aiori_mod_opt_t *) o;
|
||||||
};
|
|
||||||
|
option_help h [] = {
|
||||||
|
{0, "daos.pool", "pool uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o->pool},
|
||||||
|
{0, "daos.svcl", "pool SVCL", OPTION_OPTIONAL_ARGUMENT, 's', &o->svcl},
|
||||||
|
{0, "daos.group", "server group", OPTION_OPTIONAL_ARGUMENT, 's', &o->group},
|
||||||
|
{0, "daos.cont", "container uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o->cont},
|
||||||
|
{0, "daos.chunk_size", "chunk size", OPTION_OPTIONAL_ARGUMENT, 'd', &o->chunk_size},
|
||||||
|
{0, "daos.destroy", "Destroy Container", OPTION_FLAG, 'd', &o->destroy},
|
||||||
|
{0, "daos.oclass", "object class", OPTION_OPTIONAL_ARGUMENT, 's', &o->oclass},
|
||||||
|
LAST_OPTION
|
||||||
|
};
|
||||||
|
|
||||||
|
option_help * help = malloc(sizeof(h));
|
||||||
|
memcpy(help, h, sizeof(h));
|
||||||
|
return help;
|
||||||
|
}
|
||||||
|
|
||||||
/**************************** P R O T O T Y P E S *****************************/
|
/**************************** P R O T O T Y P E S *****************************/
|
||||||
|
|
||||||
static void DAOS_Init();
|
static void DAOS_Init(aiori_mod_opt_t *);
|
||||||
static void DAOS_Fini();
|
static void DAOS_Fini(aiori_mod_opt_t *);
|
||||||
static void *DAOS_Create(char *, IOR_param_t *);
|
static aiori_fd_t *DAOS_Create(char *, int, aiori_mod_opt_t *);
|
||||||
static void *DAOS_Open(char *, IOR_param_t *);
|
static aiori_fd_t *DAOS_Open(char *, int, aiori_mod_opt_t *);
|
||||||
static int DAOS_Access(const char *, int, IOR_param_t *);
|
static int DAOS_Access(const char *, int, aiori_mod_opt_t *);
|
||||||
static IOR_offset_t DAOS_Xfer(int, void *, IOR_size_t *,
|
static IOR_offset_t DAOS_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t,
|
||||||
IOR_offset_t, IOR_param_t *);
|
IOR_offset_t, aiori_mod_opt_t *);
|
||||||
static void DAOS_Close(void *, IOR_param_t *);
|
static void DAOS_Close(aiori_fd_t *, aiori_mod_opt_t *);
|
||||||
static void DAOS_Delete(char *, IOR_param_t *);
|
static void DAOS_Delete(char *, aiori_mod_opt_t *);
|
||||||
static char* DAOS_GetVersion();
|
static char* DAOS_GetVersion();
|
||||||
static void DAOS_Fsync(void *, IOR_param_t *);
|
static void DAOS_Fsync(aiori_fd_t *, aiori_mod_opt_t *);
|
||||||
static IOR_offset_t DAOS_GetFileSize(IOR_param_t *, MPI_Comm, char *);
|
static IOR_offset_t DAOS_GetFileSize(aiori_mod_opt_t *, MPI_Comm, char *);
|
||||||
static option_help * DAOS_options();
|
static option_help * DAOS_options();
|
||||||
|
static void DAOS_init_xfer_options(aiori_xfer_hint_t *);
|
||||||
|
static int DAOS_check_params(aiori_mod_opt_t *);
|
||||||
|
|
||||||
/************************** D E C L A R A T I O N S ***************************/
|
/************************** D E C L A R A T I O N S ***************************/
|
||||||
|
|
||||||
ior_aiori_t daos_aiori = {
|
ior_aiori_t daos_aiori = {
|
||||||
.name = "DAOS",
|
.name = "DAOS",
|
||||||
|
.initialize = DAOS_Init,
|
||||||
|
.finalize = DAOS_Fini,
|
||||||
.create = DAOS_Create,
|
.create = DAOS_Create,
|
||||||
.open = DAOS_Open,
|
.open = DAOS_Open,
|
||||||
.access = DAOS_Access,
|
.access = DAOS_Access,
|
||||||
|
@ -90,15 +104,17 @@ ior_aiori_t daos_aiori = {
|
||||||
.close = DAOS_Close,
|
.close = DAOS_Close,
|
||||||
.delete = DAOS_Delete,
|
.delete = DAOS_Delete,
|
||||||
.get_version = DAOS_GetVersion,
|
.get_version = DAOS_GetVersion,
|
||||||
|
.xfer_hints = DAOS_init_xfer_options,
|
||||||
.fsync = DAOS_Fsync,
|
.fsync = DAOS_Fsync,
|
||||||
.get_file_size = DAOS_GetFileSize,
|
.get_file_size = DAOS_GetFileSize,
|
||||||
.initialize = DAOS_Init,
|
|
||||||
.finalize = DAOS_Fini,
|
|
||||||
.get_options = DAOS_options,
|
|
||||||
.statfs = aiori_posix_statfs,
|
.statfs = aiori_posix_statfs,
|
||||||
.mkdir = aiori_posix_mkdir,
|
.mkdir = aiori_posix_mkdir,
|
||||||
.rmdir = aiori_posix_rmdir,
|
.rmdir = aiori_posix_rmdir,
|
||||||
.stat = aiori_posix_stat,
|
.stat = aiori_posix_stat,
|
||||||
|
.get_options = DAOS_options,
|
||||||
|
.xfer_hints = DAOS_init_xfer_options,
|
||||||
|
.check_params = DAOS_check_params,
|
||||||
|
.enable_mdtest = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define IOR_DAOS_MUR_SEED 0xDEAD10CC
|
#define IOR_DAOS_MUR_SEED 0xDEAD10CC
|
||||||
|
@ -144,6 +160,22 @@ do { \
|
||||||
MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error"); \
|
MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
static aiori_xfer_hint_t * hints = NULL;
|
||||||
|
|
||||||
|
void DAOS_init_xfer_options(aiori_xfer_hint_t * params)
|
||||||
|
{
|
||||||
|
hints = params;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int DAOS_check_params(aiori_mod_opt_t * options){
|
||||||
|
DAOS_options_t *o = (DAOS_options_t *) options;
|
||||||
|
|
||||||
|
if (o->pool == NULL || o->svcl == NULL || o->cont == NULL)
|
||||||
|
ERR("Invalid pool or container options\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Distribute process 0's pool or container handle to others. */
|
/* Distribute process 0's pool or container handle to others. */
|
||||||
static void
|
static void
|
||||||
HandleDistribute(daos_handle_t *handle, enum handleType type)
|
HandleDistribute(daos_handle_t *handle, enum handleType type)
|
||||||
|
@ -202,29 +234,24 @@ HandleDistribute(daos_handle_t *handle, enum handleType type)
|
||||||
free(global.iov_buf);
|
free(global.iov_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static option_help *
|
|
||||||
DAOS_options()
|
|
||||||
{
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DAOS_Init()
|
DAOS_Init(aiori_mod_opt_t * options)
|
||||||
{
|
{
|
||||||
|
DAOS_options_t *o = (DAOS_options_t *)options;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (daos_initialized)
|
if (daos_initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (o.pool == NULL || o.svcl == NULL || o.cont == NULL) {
|
if (o->pool == NULL || o->svcl == NULL || o->cont == NULL) {
|
||||||
GERR("Invalid DAOS pool/cont\n");
|
GERR("Invalid DAOS pool/cont\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (o.oclass) {
|
if (o->oclass) {
|
||||||
objectClass = daos_oclass_name2id(o.oclass);
|
objectClass = daos_oclass_name2id(o->oclass);
|
||||||
if (objectClass == OC_UNKNOWN)
|
if (objectClass == OC_UNKNOWN)
|
||||||
GERR("Invalid DAOS Object class %s\n", o.oclass);
|
GERR("Invalid DAOS Object class %s\n", o->oclass);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = daos_init();
|
rc = daos_init();
|
||||||
|
@ -237,25 +264,25 @@ DAOS_Init()
|
||||||
static daos_pool_info_t po_info;
|
static daos_pool_info_t po_info;
|
||||||
static daos_cont_info_t co_info;
|
static daos_cont_info_t co_info;
|
||||||
|
|
||||||
INFO(VERBOSE_1, "Connecting to pool %s", o.pool);
|
INFO(VERBOSE_1, "Connecting to pool %s", o->pool);
|
||||||
|
|
||||||
rc = uuid_parse(o.pool, uuid);
|
rc = uuid_parse(o->pool, uuid);
|
||||||
DCHECK(rc, "Failed to parse 'pool': %s", o.pool);
|
DCHECK(rc, "Failed to parse 'pool': %s", o->pool);
|
||||||
|
|
||||||
svcl = daos_rank_list_parse(o.svcl, ":");
|
svcl = daos_rank_list_parse(o->svcl, ":");
|
||||||
if (svcl == NULL)
|
if (svcl == NULL)
|
||||||
ERR("Failed to allocate svcl");
|
ERR("Failed to allocate svcl");
|
||||||
|
|
||||||
rc = daos_pool_connect(uuid, o.group, svcl, DAOS_PC_RW,
|
rc = daos_pool_connect(uuid, o->group, svcl, DAOS_PC_RW,
|
||||||
&poh, &po_info, NULL);
|
&poh, &po_info, NULL);
|
||||||
d_rank_list_free(svcl);
|
d_rank_list_free(svcl);
|
||||||
DCHECK(rc, "Failed to connect to pool %s", o.pool);
|
DCHECK(rc, "Failed to connect to pool %s", o->pool);
|
||||||
|
|
||||||
INFO(VERBOSE_1, "Create/Open Container %s", o.cont);
|
INFO(VERBOSE_1, "Create/Open Container %s", o->cont);
|
||||||
|
|
||||||
uuid_clear(uuid);
|
uuid_clear(uuid);
|
||||||
rc = uuid_parse(o.cont, uuid);
|
rc = uuid_parse(o->cont, uuid);
|
||||||
DCHECK(rc, "Failed to parse 'cont': %s", o.cont);
|
DCHECK(rc, "Failed to parse 'cont': %s", o->cont);
|
||||||
|
|
||||||
rc = daos_cont_open(poh, uuid, DAOS_COO_RW, &coh, &co_info,
|
rc = daos_cont_open(poh, uuid, DAOS_COO_RW, &coh, &co_info,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -278,8 +305,9 @@ DAOS_Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DAOS_Fini()
|
DAOS_Fini(aiori_mod_opt_t *options)
|
||||||
{
|
{
|
||||||
|
DAOS_options_t *o = (DAOS_options_t *)options;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (!daos_initialized)
|
if (!daos_initialized)
|
||||||
|
@ -288,18 +316,18 @@ DAOS_Fini()
|
||||||
MPI_Barrier(MPI_COMM_WORLD);
|
MPI_Barrier(MPI_COMM_WORLD);
|
||||||
rc = daos_cont_close(coh, NULL);
|
rc = daos_cont_close(coh, NULL);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
DCHECK(rc, "Failed to close container %s (%d)", o.cont, rc);
|
DCHECK(rc, "Failed to close container %s (%d)", o->cont, rc);
|
||||||
MPI_Abort(MPI_COMM_WORLD, -1);
|
MPI_Abort(MPI_COMM_WORLD, -1);
|
||||||
}
|
}
|
||||||
MPI_Barrier(MPI_COMM_WORLD);
|
MPI_Barrier(MPI_COMM_WORLD);
|
||||||
|
|
||||||
if (o.destroy) {
|
if (o->destroy) {
|
||||||
if (rank == 0) {
|
if (rank == 0) {
|
||||||
uuid_t uuid;
|
uuid_t uuid;
|
||||||
double t1, t2;
|
double t1, t2;
|
||||||
|
|
||||||
INFO(VERBOSE_1, "Destroying DAOS Container %s", o.cont);
|
INFO(VERBOSE_1, "Destroying DAOS Container %s", o->cont);
|
||||||
uuid_parse(o.cont, uuid);
|
uuid_parse(o->cont, uuid);
|
||||||
t1 = MPI_Wtime();
|
t1 = MPI_Wtime();
|
||||||
rc = daos_cont_destroy(poh, uuid, 1, NULL);
|
rc = daos_cont_destroy(poh, uuid, 1, NULL);
|
||||||
t2 = MPI_Wtime();
|
t2 = MPI_Wtime();
|
||||||
|
@ -310,7 +338,7 @@ DAOS_Fini()
|
||||||
MPI_Bcast(&rc, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
MPI_Bcast(&rc, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
if (rank == 0)
|
if (rank == 0)
|
||||||
DCHECK(rc, "Failed to destroy container %s (%d)", o.cont, rc);
|
DCHECK(rc, "Failed to destroy container %s (%d)", o->cont, rc);
|
||||||
MPI_Abort(MPI_COMM_WORLD, -1);
|
MPI_Abort(MPI_COMM_WORLD, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -319,7 +347,7 @@ DAOS_Fini()
|
||||||
INFO(VERBOSE_1, "Disconnecting from DAOS POOL..");
|
INFO(VERBOSE_1, "Disconnecting from DAOS POOL..");
|
||||||
|
|
||||||
rc = daos_pool_disconnect(poh, NULL);
|
rc = daos_pool_disconnect(poh, NULL);
|
||||||
DCHECK(rc, "Failed to disconnect from pool %s", o.pool);
|
DCHECK(rc, "Failed to disconnect from pool %s", o->pool);
|
||||||
|
|
||||||
MPI_CHECK(MPI_Barrier(MPI_COMM_WORLD), "barrier error");
|
MPI_CHECK(MPI_Barrier(MPI_COMM_WORLD), "barrier error");
|
||||||
if (rank == 0)
|
if (rank == 0)
|
||||||
|
@ -334,38 +362,38 @@ DAOS_Fini()
|
||||||
static void
|
static void
|
||||||
gen_oid(const char *name, daos_obj_id_t *oid)
|
gen_oid(const char *name, daos_obj_id_t *oid)
|
||||||
{
|
{
|
||||||
|
|
||||||
oid->lo = d_hash_murmur64(name, strlen(name), IOR_DAOS_MUR_SEED);
|
oid->lo = d_hash_murmur64(name, strlen(name), IOR_DAOS_MUR_SEED);
|
||||||
oid->hi = 0;
|
oid->hi = 0;
|
||||||
|
|
||||||
daos_array_generate_id(oid, objectClass, true, 0);
|
daos_array_generate_id(oid, objectClass, true, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static aiori_fd_t *
|
||||||
DAOS_Create(char *testFileName, IOR_param_t *param)
|
DAOS_Create(char *testFileName, int flags, aiori_mod_opt_t *param)
|
||||||
{
|
{
|
||||||
|
DAOS_options_t *o = (DAOS_options_t*) param;
|
||||||
daos_obj_id_t oid;
|
daos_obj_id_t oid;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/** Convert file name into object ID */
|
/** Convert file name into object ID */
|
||||||
gen_oid(testFileName, &oid);
|
gen_oid(testFileName, &oid);
|
||||||
|
|
||||||
/** Create the array */
|
/** Create the array */
|
||||||
if (param->filePerProc || rank == 0) {
|
if (hints->filePerProc || rank == 0) {
|
||||||
rc = daos_array_create(coh, oid, DAOS_TX_NONE, 1, o.chunk_size,
|
rc = daos_array_create(coh, oid, DAOS_TX_NONE, 1, o->chunk_size,
|
||||||
&aoh, NULL);
|
&aoh, NULL);
|
||||||
DCHECK(rc, "Failed to create array object\n");
|
DCHECK(rc, "Failed to create array object\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Distribute the array handle if not FPP */
|
/** Distribute the array handle if not FPP */
|
||||||
if (!param->filePerProc)
|
if (!hints->filePerProc)
|
||||||
HandleDistribute(&aoh, ARRAY_HANDLE);
|
HandleDistribute(&aoh, ARRAY_HANDLE);
|
||||||
|
|
||||||
return &aoh;
|
return (aiori_fd_t*)(&aoh);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
DAOS_Access(const char *testFileName, int mode, IOR_param_t * param)
|
DAOS_Access(const char *testFileName, int mode, aiori_mod_opt_t * param)
|
||||||
{
|
{
|
||||||
daos_obj_id_t oid;
|
daos_obj_id_t oid;
|
||||||
daos_size_t cell_size, chunk_size;
|
daos_size_t cell_size, chunk_size;
|
||||||
|
@ -387,8 +415,8 @@ DAOS_Access(const char *testFileName, int mode, IOR_param_t * param)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static aiori_fd_t *
|
||||||
DAOS_Open(char *testFileName, IOR_param_t *param)
|
DAOS_Open(char *testFileName, int flags, aiori_mod_opt_t *param)
|
||||||
{
|
{
|
||||||
daos_obj_id_t oid;
|
daos_obj_id_t oid;
|
||||||
|
|
||||||
|
@ -396,7 +424,7 @@ DAOS_Open(char *testFileName, IOR_param_t *param)
|
||||||
gen_oid(testFileName, &oid);
|
gen_oid(testFileName, &oid);
|
||||||
|
|
||||||
/** Open the array */
|
/** Open the array */
|
||||||
if (param->filePerProc || rank == 0) {
|
if (hints->filePerProc || rank == 0) {
|
||||||
daos_size_t cell_size, chunk_size;
|
daos_size_t cell_size, chunk_size;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
@ -409,15 +437,15 @@ DAOS_Open(char *testFileName, IOR_param_t *param)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Distribute the array handle if not FPP */
|
/** Distribute the array handle if not FPP */
|
||||||
if (!param->filePerProc)
|
if (!hints->filePerProc)
|
||||||
HandleDistribute(&aoh, ARRAY_HANDLE);
|
HandleDistribute(&aoh, ARRAY_HANDLE);
|
||||||
|
|
||||||
return &aoh;
|
return (aiori_fd_t*)(&aoh);
|
||||||
}
|
}
|
||||||
|
|
||||||
static IOR_offset_t
|
static IOR_offset_t
|
||||||
DAOS_Xfer(int access, void *file, IOR_size_t *buffer,
|
DAOS_Xfer(int access, aiori_fd_t *file, IOR_size_t *buffer, IOR_offset_t length,
|
||||||
IOR_offset_t length, IOR_param_t *param)
|
IOR_offset_t off, aiori_mod_opt_t *param)
|
||||||
{
|
{
|
||||||
daos_array_iod_t iod;
|
daos_array_iod_t iod;
|
||||||
daos_range_t rg;
|
daos_range_t rg;
|
||||||
|
@ -428,7 +456,7 @@ DAOS_Xfer(int access, void *file, IOR_size_t *buffer,
|
||||||
/** set array location */
|
/** set array location */
|
||||||
iod.arr_nr = 1;
|
iod.arr_nr = 1;
|
||||||
rg.rg_len = length;
|
rg.rg_len = length;
|
||||||
rg.rg_idx = param->offset;
|
rg.rg_idx = off;
|
||||||
iod.arr_rgs = &rg;
|
iod.arr_rgs = &rg;
|
||||||
|
|
||||||
/** set memory location */
|
/** set memory location */
|
||||||
|
@ -448,7 +476,7 @@ DAOS_Xfer(int access, void *file, IOR_size_t *buffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DAOS_Close(void *file, IOR_param_t *param)
|
DAOS_Close(aiori_fd_t *file, aiori_mod_opt_t *param)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
@ -462,7 +490,7 @@ DAOS_Close(void *file, IOR_param_t *param)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DAOS_Delete(char *testFileName, IOR_param_t *param)
|
DAOS_Delete(char *testFileName, aiori_mod_opt_t *param)
|
||||||
{
|
{
|
||||||
daos_obj_id_t oid;
|
daos_obj_id_t oid;
|
||||||
daos_size_t cell_size, chunk_size;
|
daos_size_t cell_size, chunk_size;
|
||||||
|
@ -500,13 +528,13 @@ DAOS_GetVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DAOS_Fsync(void *file, IOR_param_t *param)
|
DAOS_Fsync(aiori_fd_t *file, aiori_mod_opt_t *param)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IOR_offset_t
|
static IOR_offset_t
|
||||||
DAOS_GetFileSize(IOR_param_t *param, MPI_Comm testComm, char *testFileName)
|
DAOS_GetFileSize(aiori_mod_opt_t *param, MPI_Comm comm, char *testFileName)
|
||||||
{
|
{
|
||||||
daos_obj_id_t oid;
|
daos_obj_id_t oid;
|
||||||
daos_size_t size;
|
daos_size_t size;
|
||||||
|
@ -519,7 +547,7 @@ DAOS_GetFileSize(IOR_param_t *param, MPI_Comm testComm, char *testFileName)
|
||||||
gen_oid(testFileName, &oid);
|
gen_oid(testFileName, &oid);
|
||||||
|
|
||||||
/** open the array to verify it exists */
|
/** open the array to verify it exists */
|
||||||
if (param->filePerProc || rank == 0) {
|
if (hints->filePerProc || rank == 0) {
|
||||||
daos_size_t cell_size, chunk_size;
|
daos_size_t cell_size, chunk_size;
|
||||||
|
|
||||||
rc = daos_array_open(coh, oid, DAOS_TX_NONE, DAOS_OO_RO,
|
rc = daos_array_open(coh, oid, DAOS_TX_NONE, DAOS_OO_RO,
|
||||||
|
@ -537,7 +565,7 @@ DAOS_GetFileSize(IOR_param_t *param, MPI_Comm testComm, char *testFileName)
|
||||||
aoh.cookie = 0;
|
aoh.cookie = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!param->filePerProc)
|
if (!hints->filePerProc)
|
||||||
MPI_Bcast(&size, 1, MPI_LONG, 0, MPI_COMM_WORLD);
|
MPI_Bcast(&size, 1, MPI_LONG, 0, MPI_COMM_WORLD);
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
|
|
242
src/aiori-DFS.c
242
src/aiori-DFS.c
|
@ -27,15 +27,15 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
|
|
||||||
|
#include <mpi.h>
|
||||||
#include <gurt/common.h>
|
#include <gurt/common.h>
|
||||||
#include <gurt/hash.h>
|
#include <gurt/hash.h>
|
||||||
#include <daos.h>
|
#include <daos.h>
|
||||||
#include <daos_fs.h>
|
#include <daos_fs.h>
|
||||||
|
|
||||||
#include "ior.h"
|
|
||||||
#include "iordef.h"
|
|
||||||
#include "aiori.h"
|
#include "aiori.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
#include "iordef.h"
|
||||||
|
|
||||||
dfs_t *dfs;
|
dfs_t *dfs;
|
||||||
static daos_handle_t poh, coh;
|
static daos_handle_t poh, coh;
|
||||||
|
@ -56,7 +56,7 @@ enum handleType {
|
||||||
};
|
};
|
||||||
|
|
||||||
/************************** O P T I O N S *****************************/
|
/************************** O P T I O N S *****************************/
|
||||||
struct dfs_options{
|
typedef struct {
|
||||||
char *pool;
|
char *pool;
|
||||||
char *svcl;
|
char *svcl;
|
||||||
char *group;
|
char *group;
|
||||||
|
@ -66,57 +66,69 @@ struct dfs_options{
|
||||||
char *dir_oclass;
|
char *dir_oclass;
|
||||||
char *prefix;
|
char *prefix;
|
||||||
int destroy;
|
int destroy;
|
||||||
};
|
} DFS_options_t;
|
||||||
|
|
||||||
static struct dfs_options o = {
|
static option_help * DFS_options(aiori_mod_opt_t ** init_backend_options,
|
||||||
.pool = NULL,
|
aiori_mod_opt_t * init_values){
|
||||||
.svcl = NULL,
|
DFS_options_t * o = malloc(sizeof(DFS_options_t));
|
||||||
.group = NULL,
|
|
||||||
.cont = NULL,
|
|
||||||
.chunk_size = 1048576,
|
|
||||||
.oclass = NULL,
|
|
||||||
.dir_oclass = NULL,
|
|
||||||
.prefix = NULL,
|
|
||||||
.destroy = 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
static option_help options [] = {
|
if (init_values != NULL) {
|
||||||
{0, "dfs.pool", "pool uuid", OPTION_OPTIONAL_ARGUMENT, 's', & o.pool},
|
memcpy(o, init_values, sizeof(DFS_options_t));
|
||||||
{0, "dfs.svcl", "pool SVCL", OPTION_OPTIONAL_ARGUMENT, 's', & o.svcl},
|
} else {
|
||||||
{0, "dfs.group", "server group", OPTION_OPTIONAL_ARGUMENT, 's', & o.group},
|
memset(o, 0, sizeof(DFS_options_t));
|
||||||
{0, "dfs.cont", "DFS container uuid", OPTION_OPTIONAL_ARGUMENT, 's', & o.cont},
|
/* initialize the options properly */
|
||||||
{0, "dfs.chunk_size", "chunk size", OPTION_OPTIONAL_ARGUMENT, 'd', &o.chunk_size},
|
o->chunk_size = 1048576;
|
||||||
{0, "dfs.oclass", "object class", OPTION_OPTIONAL_ARGUMENT, 's', &o.oclass},
|
}
|
||||||
{0, "dfs.dir_oclass", "directory object class", OPTION_OPTIONAL_ARGUMENT, 's', &o.dir_oclass},
|
|
||||||
{0, "dfs.prefix", "mount prefix", OPTION_OPTIONAL_ARGUMENT, 's', & o.prefix},
|
*init_backend_options = (aiori_mod_opt_t *) o;
|
||||||
{0, "dfs.destroy", "Destroy DFS Container", OPTION_FLAG, 'd', &o.destroy},
|
|
||||||
LAST_OPTION
|
option_help h [] = {
|
||||||
};
|
{0, "dfs.pool", "pool uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o->pool},
|
||||||
|
{0, "dfs.svcl", "pool SVCL", OPTION_OPTIONAL_ARGUMENT, 's', &o->svcl},
|
||||||
|
{0, "dfs.group", "server group", OPTION_OPTIONAL_ARGUMENT, 's', &o->group},
|
||||||
|
{0, "dfs.cont", "DFS container uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o->cont},
|
||||||
|
{0, "dfs.chunk_size", "chunk size", OPTION_OPTIONAL_ARGUMENT, 'd', &o->chunk_size},
|
||||||
|
{0, "dfs.oclass", "object class", OPTION_OPTIONAL_ARGUMENT, 's', &o->oclass},
|
||||||
|
{0, "dfs.dir_oclass", "directory object class", OPTION_OPTIONAL_ARGUMENT, 's',
|
||||||
|
&o->dir_oclass},
|
||||||
|
{0, "dfs.prefix", "mount prefix", OPTION_OPTIONAL_ARGUMENT, 's', &o->prefix},
|
||||||
|
{0, "dfs.destroy", "Destroy DFS Container", OPTION_FLAG, 'd', &o->destroy},
|
||||||
|
LAST_OPTION
|
||||||
|
};
|
||||||
|
|
||||||
|
option_help * help = malloc(sizeof(h));
|
||||||
|
memcpy(help, h, sizeof(h));
|
||||||
|
return help;
|
||||||
|
}
|
||||||
|
|
||||||
/**************************** P R O T O T Y P E S *****************************/
|
/**************************** P R O T O T Y P E S *****************************/
|
||||||
static void *DFS_Create(char *, IOR_param_t *);
|
static void DFS_Init(aiori_mod_opt_t *);
|
||||||
static void *DFS_Open(char *, IOR_param_t *);
|
static void DFS_Finalize(aiori_mod_opt_t *);
|
||||||
static IOR_offset_t DFS_Xfer(int, void *, IOR_size_t *,
|
static aiori_fd_t *DFS_Create(char *, int, aiori_mod_opt_t *);
|
||||||
IOR_offset_t, IOR_param_t *);
|
static aiori_fd_t *DFS_Open(char *, int, aiori_mod_opt_t *);
|
||||||
static void DFS_Close(void *, IOR_param_t *);
|
static IOR_offset_t DFS_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t,
|
||||||
static void DFS_Delete(char *, IOR_param_t *);
|
IOR_offset_t, aiori_mod_opt_t *);
|
||||||
|
static void DFS_Close(aiori_fd_t *, aiori_mod_opt_t *);
|
||||||
|
static void DFS_Delete(char *, aiori_mod_opt_t *);
|
||||||
static char* DFS_GetVersion();
|
static char* DFS_GetVersion();
|
||||||
static void DFS_Fsync(void *, IOR_param_t *);
|
static void DFS_Fsync(aiori_fd_t *, aiori_mod_opt_t *);
|
||||||
static void DFS_Sync(IOR_param_t *);
|
static void DFS_Sync(aiori_mod_opt_t *);
|
||||||
static IOR_offset_t DFS_GetFileSize(IOR_param_t *, MPI_Comm, char *);
|
static IOR_offset_t DFS_GetFileSize(aiori_mod_opt_t *, MPI_Comm, char *);
|
||||||
static int DFS_Statfs (const char *, ior_aiori_statfs_t *, IOR_param_t *);
|
static int DFS_Statfs (const char *, ior_aiori_statfs_t *, aiori_mod_opt_t *);
|
||||||
static int DFS_Stat (const char *, struct stat *, IOR_param_t *);
|
static int DFS_Stat (const char *, struct stat *, aiori_mod_opt_t *);
|
||||||
static int DFS_Mkdir (const char *, mode_t, IOR_param_t *);
|
static int DFS_Mkdir (const char *, mode_t, aiori_mod_opt_t *);
|
||||||
static int DFS_Rmdir (const char *, IOR_param_t *);
|
static int DFS_Rmdir (const char *, aiori_mod_opt_t *);
|
||||||
static int DFS_Access (const char *, int, IOR_param_t *);
|
static int DFS_Access (const char *, int, aiori_mod_opt_t *);
|
||||||
static void DFS_Init();
|
|
||||||
static void DFS_Finalize();
|
|
||||||
static option_help * DFS_options();
|
static option_help * DFS_options();
|
||||||
|
static void DFS_init_xfer_options(aiori_xfer_hint_t *);
|
||||||
|
static int DFS_check_params(aiori_mod_opt_t *);
|
||||||
|
|
||||||
/************************** D E C L A R A T I O N S ***************************/
|
/************************** D E C L A R A T I O N S ***************************/
|
||||||
|
|
||||||
ior_aiori_t dfs_aiori = {
|
ior_aiori_t dfs_aiori = {
|
||||||
.name = "DFS",
|
.name = "DFS",
|
||||||
|
.initialize = DFS_Init,
|
||||||
|
.finalize = DFS_Finalize,
|
||||||
.create = DFS_Create,
|
.create = DFS_Create,
|
||||||
.open = DFS_Open,
|
.open = DFS_Open,
|
||||||
.xfer = DFS_Xfer,
|
.xfer = DFS_Xfer,
|
||||||
|
@ -126,14 +138,14 @@ ior_aiori_t dfs_aiori = {
|
||||||
.fsync = DFS_Fsync,
|
.fsync = DFS_Fsync,
|
||||||
.sync = DFS_Sync,
|
.sync = DFS_Sync,
|
||||||
.get_file_size = DFS_GetFileSize,
|
.get_file_size = DFS_GetFileSize,
|
||||||
|
.xfer_hints = DFS_init_xfer_options,
|
||||||
.statfs = DFS_Statfs,
|
.statfs = DFS_Statfs,
|
||||||
.mkdir = DFS_Mkdir,
|
.mkdir = DFS_Mkdir,
|
||||||
.rmdir = DFS_Rmdir,
|
.rmdir = DFS_Rmdir,
|
||||||
.access = DFS_Access,
|
.access = DFS_Access,
|
||||||
.stat = DFS_Stat,
|
.stat = DFS_Stat,
|
||||||
.initialize = DFS_Init,
|
|
||||||
.finalize = DFS_Finalize,
|
|
||||||
.get_options = DFS_options,
|
.get_options = DFS_options,
|
||||||
|
.check_params = DFS_check_params,
|
||||||
.enable_mdtest = true,
|
.enable_mdtest = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -165,6 +177,22 @@ do { \
|
||||||
MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error"); \
|
MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
static aiori_xfer_hint_t * hints = NULL;
|
||||||
|
|
||||||
|
void DFS_init_xfer_options(aiori_xfer_hint_t * params)
|
||||||
|
{
|
||||||
|
hints = params;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int DFS_check_params(aiori_mod_opt_t * options){
|
||||||
|
DFS_options_t *o = (DFS_options_t *) options;
|
||||||
|
|
||||||
|
if (o->pool == NULL || o->svcl == NULL || o->cont == NULL)
|
||||||
|
ERR("Invalid pool or container options\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static inline struct aiori_dir_hdl *
|
static inline struct aiori_dir_hdl *
|
||||||
hdl_obj(d_list_t *rlink)
|
hdl_obj(d_list_t *rlink)
|
||||||
{
|
{
|
||||||
|
@ -378,27 +406,25 @@ lookup_insert_dir(const char *name, mode_t *mode)
|
||||||
return hdl->oh;
|
return hdl->oh;
|
||||||
}
|
}
|
||||||
|
|
||||||
static option_help * DFS_options(){
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DFS_Init() {
|
DFS_Init(aiori_mod_opt_t * options)
|
||||||
|
{
|
||||||
|
DFS_options_t *o = (DFS_options_t *)options;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (o.pool == NULL || o.svcl == NULL || o.cont == NULL)
|
if (o->pool == NULL || o->svcl == NULL || o->cont == NULL)
|
||||||
ERR("Invalid pool or container options\n");
|
ERR("Invalid pool or container options\n");
|
||||||
|
|
||||||
if (o.oclass) {
|
if (o->oclass) {
|
||||||
objectClass = daos_oclass_name2id(o.oclass);
|
objectClass = daos_oclass_name2id(o->oclass);
|
||||||
if (objectClass == OC_UNKNOWN)
|
if (objectClass == OC_UNKNOWN)
|
||||||
GERR("Invalid DAOS object class %s\n", o.oclass);
|
GERR("Invalid DAOS object class %s\n", o->oclass);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (o.dir_oclass) {
|
if (o->dir_oclass) {
|
||||||
dir_oclass = daos_oclass_name2id(o.dir_oclass);
|
dir_oclass = daos_oclass_name2id(o->dir_oclass);
|
||||||
if (dir_oclass == OC_UNKNOWN)
|
if (dir_oclass == OC_UNKNOWN)
|
||||||
GERR("Invalid DAOS directory object class %s\n", o.dir_oclass);
|
GERR("Invalid DAOS directory object class %s\n", o->dir_oclass);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = daos_init();
|
rc = daos_init();
|
||||||
|
@ -413,21 +439,21 @@ DFS_Init() {
|
||||||
daos_pool_info_t pool_info;
|
daos_pool_info_t pool_info;
|
||||||
daos_cont_info_t co_info;
|
daos_cont_info_t co_info;
|
||||||
|
|
||||||
rc = uuid_parse(o.pool, pool_uuid);
|
rc = uuid_parse(o->pool, pool_uuid);
|
||||||
DCHECK(rc, "Failed to parse 'Pool uuid': %s", o.pool);
|
DCHECK(rc, "Failed to parse 'Pool uuid': %s", o->pool);
|
||||||
|
|
||||||
rc = uuid_parse(o.cont, co_uuid);
|
rc = uuid_parse(o->cont, co_uuid);
|
||||||
DCHECK(rc, "Failed to parse 'Cont uuid': %s", o.cont);
|
DCHECK(rc, "Failed to parse 'Cont uuid': %s", o->cont);
|
||||||
|
|
||||||
svcl = daos_rank_list_parse(o.svcl, ":");
|
svcl = daos_rank_list_parse(o->svcl, ":");
|
||||||
if (svcl == NULL)
|
if (svcl == NULL)
|
||||||
ERR("Failed to allocate svcl");
|
ERR("Failed to allocate svcl");
|
||||||
|
|
||||||
INFO(VERBOSE_1, "Pool uuid = %s, SVCL = %s\n", o.pool, o.svcl);
|
INFO(VERBOSE_1, "Pool uuid = %s, SVCL = %s\n", o->pool, o->svcl);
|
||||||
INFO(VERBOSE_1, "DFS Container namespace uuid = %s\n", o.cont);
|
INFO(VERBOSE_1, "DFS Container namespace uuid = %s\n", o->cont);
|
||||||
|
|
||||||
/** Connect to DAOS pool */
|
/** Connect to DAOS pool */
|
||||||
rc = daos_pool_connect(pool_uuid, o.group, svcl, DAOS_PC_RW,
|
rc = daos_pool_connect(pool_uuid, o->group, svcl, DAOS_PC_RW,
|
||||||
&poh, &pool_info, NULL);
|
&poh, &pool_info, NULL);
|
||||||
d_rank_list_free(svcl);
|
d_rank_list_free(svcl);
|
||||||
DCHECK(rc, "Failed to connect to pool");
|
DCHECK(rc, "Failed to connect to pool");
|
||||||
|
@ -453,15 +479,16 @@ DFS_Init() {
|
||||||
HandleDistribute(CONT_HANDLE);
|
HandleDistribute(CONT_HANDLE);
|
||||||
HandleDistribute(DFS_HANDLE);
|
HandleDistribute(DFS_HANDLE);
|
||||||
|
|
||||||
if (o.prefix) {
|
if (o->prefix) {
|
||||||
rc = dfs_set_prefix(dfs, o.prefix);
|
rc = dfs_set_prefix(dfs, o->prefix);
|
||||||
DCHECK(rc, "Failed to set DFS Prefix");
|
DCHECK(rc, "Failed to set DFS Prefix");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DFS_Finalize()
|
DFS_Finalize(aiori_mod_opt_t *options)
|
||||||
{
|
{
|
||||||
|
DFS_options_t *o = (DFS_options_t *)options;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
MPI_Barrier(MPI_COMM_WORLD);
|
MPI_Barrier(MPI_COMM_WORLD);
|
||||||
|
@ -472,16 +499,16 @@ DFS_Finalize()
|
||||||
MPI_Barrier(MPI_COMM_WORLD);
|
MPI_Barrier(MPI_COMM_WORLD);
|
||||||
|
|
||||||
rc = daos_cont_close(coh, NULL);
|
rc = daos_cont_close(coh, NULL);
|
||||||
DCHECK(rc, "Failed to close container %s (%d)", o.cont, rc);
|
DCHECK(rc, "Failed to close container %s (%d)", o->cont, rc);
|
||||||
MPI_Barrier(MPI_COMM_WORLD);
|
MPI_Barrier(MPI_COMM_WORLD);
|
||||||
|
|
||||||
if (o.destroy) {
|
if (o->destroy) {
|
||||||
if (rank == 0) {
|
if (rank == 0) {
|
||||||
uuid_t uuid;
|
uuid_t uuid;
|
||||||
double t1, t2;
|
double t1, t2;
|
||||||
|
|
||||||
INFO(VERBOSE_1, "Destorying DFS Container: %s\n", o.cont);
|
INFO(VERBOSE_1, "Destorying DFS Container: %s\n", o->cont);
|
||||||
uuid_parse(o.cont, uuid);
|
uuid_parse(o->cont, uuid);
|
||||||
t1 = MPI_Wtime();
|
t1 = MPI_Wtime();
|
||||||
rc = daos_cont_destroy(poh, uuid, 1, NULL);
|
rc = daos_cont_destroy(poh, uuid, 1, NULL);
|
||||||
t2 = MPI_Wtime();
|
t2 = MPI_Wtime();
|
||||||
|
@ -492,7 +519,7 @@ DFS_Finalize()
|
||||||
MPI_Bcast(&rc, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
MPI_Bcast(&rc, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
if (rank == 0)
|
if (rank == 0)
|
||||||
DCHECK(rc, "Failed to destroy container %s (%d)", o.cont, rc);
|
DCHECK(rc, "Failed to destroy container %s (%d)", o->cont, rc);
|
||||||
MPI_Abort(MPI_COMM_WORLD, -1);
|
MPI_Abort(MPI_COMM_WORLD, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -515,17 +542,16 @@ DFS_Finalize()
|
||||||
/*
|
/*
|
||||||
* Creat and open a file through the DFS interface.
|
* Creat and open a file through the DFS interface.
|
||||||
*/
|
*/
|
||||||
static void *
|
static aiori_fd_t *
|
||||||
DFS_Create(char *testFileName, IOR_param_t *param)
|
DFS_Create(char *testFileName, int flags, aiori_mod_opt_t *param)
|
||||||
{
|
{
|
||||||
|
DFS_options_t *o = (DFS_options_t*) param;
|
||||||
char *name = NULL, *dir_name = NULL;
|
char *name = NULL, *dir_name = NULL;
|
||||||
dfs_obj_t *obj = NULL, *parent = NULL;
|
dfs_obj_t *obj = NULL, *parent = NULL;
|
||||||
mode_t mode = 0644;
|
mode_t mode = 0664;
|
||||||
int fd_oflag = 0;
|
int fd_oflag = 0;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
assert(param);
|
|
||||||
|
|
||||||
rc = parse_filename(testFileName, &name, &dir_name);
|
rc = parse_filename(testFileName, &name, &dir_name);
|
||||||
DCHECK(rc, "Failed to parse path %s", testFileName);
|
DCHECK(rc, "Failed to parse path %s", testFileName);
|
||||||
assert(dir_name);
|
assert(dir_name);
|
||||||
|
@ -535,20 +561,20 @@ DFS_Create(char *testFileName, IOR_param_t *param)
|
||||||
if (parent == NULL)
|
if (parent == NULL)
|
||||||
GERR("Failed to lookup parent dir");
|
GERR("Failed to lookup parent dir");
|
||||||
|
|
||||||
mode = S_IFREG | param->mode;
|
mode = S_IFREG | mode;
|
||||||
if (param->filePerProc || rank == 0) {
|
if (hints->filePerProc || rank == 0) {
|
||||||
fd_oflag |= O_CREAT | O_RDWR | O_EXCL;
|
fd_oflag |= O_CREAT | O_RDWR | O_EXCL;
|
||||||
|
|
||||||
rc = dfs_open(dfs, parent, name, mode, fd_oflag,
|
rc = dfs_open(dfs, parent, name, mode, fd_oflag,
|
||||||
objectClass, o.chunk_size, NULL, &obj);
|
objectClass, o->chunk_size, NULL, &obj);
|
||||||
DCHECK(rc, "dfs_open() of %s Failed", name);
|
DCHECK(rc, "dfs_open() of %s Failed", name);
|
||||||
}
|
}
|
||||||
if (!param->filePerProc) {
|
if (!hints->filePerProc) {
|
||||||
MPI_Barrier(MPI_COMM_WORLD);
|
MPI_Barrier(MPI_COMM_WORLD);
|
||||||
if (rank != 0) {
|
if (rank != 0) {
|
||||||
fd_oflag |= O_RDWR;
|
fd_oflag |= O_RDWR;
|
||||||
rc = dfs_open(dfs, parent, name, mode, fd_oflag,
|
rc = dfs_open(dfs, parent, name, mode, fd_oflag,
|
||||||
objectClass, o.chunk_size, NULL, &obj);
|
objectClass, o->chunk_size, NULL, &obj);
|
||||||
DCHECK(rc, "dfs_open() of %s Failed", name);
|
DCHECK(rc, "dfs_open() of %s Failed", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -558,27 +584,27 @@ DFS_Create(char *testFileName, IOR_param_t *param)
|
||||||
if (dir_name)
|
if (dir_name)
|
||||||
free(dir_name);
|
free(dir_name);
|
||||||
|
|
||||||
return ((void *)obj);
|
return (aiori_fd_t *)(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open a file through the DFS interface.
|
* Open a file through the DFS interface.
|
||||||
*/
|
*/
|
||||||
static void *
|
static aiori_fd_t *
|
||||||
DFS_Open(char *testFileName, IOR_param_t *param)
|
DFS_Open(char *testFileName, int flags, aiori_mod_opt_t *param)
|
||||||
{
|
{
|
||||||
|
DFS_options_t *o = (DFS_options_t*) param;
|
||||||
char *name = NULL, *dir_name = NULL;
|
char *name = NULL, *dir_name = NULL;
|
||||||
dfs_obj_t *obj = NULL, *parent = NULL;
|
dfs_obj_t *obj = NULL, *parent = NULL;
|
||||||
mode_t mode;
|
mode_t mode = 0664;
|
||||||
int rc;
|
|
||||||
int fd_oflag = 0;
|
int fd_oflag = 0;
|
||||||
|
int rc;
|
||||||
|
|
||||||
fd_oflag |= O_RDWR;
|
fd_oflag |= O_RDWR;
|
||||||
mode = S_IFREG | param->mode;
|
mode = S_IFREG | flags;
|
||||||
|
|
||||||
rc = parse_filename(testFileName, &name, &dir_name);
|
rc = parse_filename(testFileName, &name, &dir_name);
|
||||||
DCHECK(rc, "Failed to parse path %s", testFileName);
|
DCHECK(rc, "Failed to parse path %s", testFileName);
|
||||||
|
|
||||||
assert(dir_name);
|
assert(dir_name);
|
||||||
assert(name);
|
assert(name);
|
||||||
|
|
||||||
|
@ -587,7 +613,7 @@ DFS_Open(char *testFileName, IOR_param_t *param)
|
||||||
GERR("Failed to lookup parent dir");
|
GERR("Failed to lookup parent dir");
|
||||||
|
|
||||||
rc = dfs_open(dfs, parent, name, mode, fd_oflag, objectClass,
|
rc = dfs_open(dfs, parent, name, mode, fd_oflag, objectClass,
|
||||||
o.chunk_size, NULL, &obj);
|
o->chunk_size, NULL, &obj);
|
||||||
DCHECK(rc, "dfs_open() of %s Failed", name);
|
DCHECK(rc, "dfs_open() of %s Failed", name);
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
|
@ -595,15 +621,15 @@ DFS_Open(char *testFileName, IOR_param_t *param)
|
||||||
if (dir_name)
|
if (dir_name)
|
||||||
free(dir_name);
|
free(dir_name);
|
||||||
|
|
||||||
return ((void *)obj);
|
return (aiori_fd_t *)(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write or read access to file using the DFS interface.
|
* Write or read access to file using the DFS interface.
|
||||||
*/
|
*/
|
||||||
static IOR_offset_t
|
static IOR_offset_t
|
||||||
DFS_Xfer(int access, void *file, IOR_size_t *buffer, IOR_offset_t length,
|
DFS_Xfer(int access, aiori_fd_t *file, IOR_size_t *buffer, IOR_offset_t length,
|
||||||
IOR_param_t *param)
|
IOR_offset_t off, aiori_mod_opt_t *param)
|
||||||
{
|
{
|
||||||
int xferRetries = 0;
|
int xferRetries = 0;
|
||||||
long long remaining = (long long)length;
|
long long remaining = (long long)length;
|
||||||
|
@ -626,20 +652,20 @@ DFS_Xfer(int access, void *file, IOR_size_t *buffer, IOR_offset_t length,
|
||||||
|
|
||||||
/* write/read file */
|
/* write/read file */
|
||||||
if (access == WRITE) {
|
if (access == WRITE) {
|
||||||
rc = dfs_write(dfs, obj, &sgl, param->offset, NULL);
|
rc = dfs_write(dfs, obj, &sgl, off, NULL);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
fprintf(stderr, "dfs_write() failed (%d)", rc);
|
fprintf(stderr, "dfs_write() failed (%d)", rc);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ret = remaining;
|
ret = remaining;
|
||||||
} else {
|
} else {
|
||||||
rc = dfs_read(dfs, obj, &sgl, param->offset, &ret, NULL);
|
rc = dfs_read(dfs, obj, &sgl, off, &ret, NULL);
|
||||||
if (rc || ret == 0)
|
if (rc || ret == 0)
|
||||||
fprintf(stderr, "dfs_read() failed(%d)", rc);
|
fprintf(stderr, "dfs_read() failed(%d)", rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret < remaining) {
|
if (ret < remaining) {
|
||||||
if (param->singleXferAttempt == TRUE)
|
if (hints->singleXferAttempt == TRUE)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
if (xferRetries > MAX_RETRY)
|
if (xferRetries > MAX_RETRY)
|
||||||
ERR("too many retries -- aborting");
|
ERR("too many retries -- aborting");
|
||||||
|
@ -659,7 +685,7 @@ DFS_Xfer(int access, void *file, IOR_size_t *buffer, IOR_offset_t length,
|
||||||
* Perform fsync().
|
* Perform fsync().
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
DFS_Fsync(void *fd, IOR_param_t * param)
|
DFS_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * param)
|
||||||
{
|
{
|
||||||
/* no cache in DFS, so this is a no-op currently */
|
/* no cache in DFS, so this is a no-op currently */
|
||||||
dfs_sync(dfs);
|
dfs_sync(dfs);
|
||||||
|
@ -670,7 +696,7 @@ DFS_Fsync(void *fd, IOR_param_t * param)
|
||||||
* Perform sync() on the dfs mount.
|
* Perform sync() on the dfs mount.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
DFS_Sync(IOR_param_t * param)
|
DFS_Sync(aiori_mod_opt_t * param)
|
||||||
{
|
{
|
||||||
/* no cache in DFS, so this is a no-op currently */
|
/* no cache in DFS, so this is a no-op currently */
|
||||||
dfs_sync(dfs);
|
dfs_sync(dfs);
|
||||||
|
@ -681,7 +707,7 @@ DFS_Sync(IOR_param_t * param)
|
||||||
* Close a file through the DFS interface.
|
* Close a file through the DFS interface.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
DFS_Close(void *fd, IOR_param_t * param)
|
DFS_Close(aiori_fd_t *fd, aiori_mod_opt_t * param)
|
||||||
{
|
{
|
||||||
dfs_release((dfs_obj_t *)fd);
|
dfs_release((dfs_obj_t *)fd);
|
||||||
}
|
}
|
||||||
|
@ -690,7 +716,7 @@ DFS_Close(void *fd, IOR_param_t * param)
|
||||||
* Delete a file through the DFS interface.
|
* Delete a file through the DFS interface.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
DFS_Delete(char *testFileName, IOR_param_t * param)
|
DFS_Delete(char *testFileName, aiori_mod_opt_t * param)
|
||||||
{
|
{
|
||||||
char *name = NULL, *dir_name = NULL;
|
char *name = NULL, *dir_name = NULL;
|
||||||
dfs_obj_t *parent = NULL;
|
dfs_obj_t *parent = NULL;
|
||||||
|
@ -727,7 +753,7 @@ static char* DFS_GetVersion()
|
||||||
* Use DFS stat() to return aggregate file size.
|
* Use DFS stat() to return aggregate file size.
|
||||||
*/
|
*/
|
||||||
static IOR_offset_t
|
static IOR_offset_t
|
||||||
DFS_GetFileSize(IOR_param_t * test, MPI_Comm comm, char *testFileName)
|
DFS_GetFileSize(aiori_mod_opt_t * test, MPI_Comm comm, char *testFileName)
|
||||||
{
|
{
|
||||||
dfs_obj_t *obj;
|
dfs_obj_t *obj;
|
||||||
daos_size_t fsize, tmpMin, tmpMax, tmpSum;
|
daos_size_t fsize, tmpMin, tmpMax, tmpSum;
|
||||||
|
@ -745,7 +771,7 @@ DFS_GetFileSize(IOR_param_t * test, MPI_Comm comm, char *testFileName)
|
||||||
|
|
||||||
dfs_release(obj);
|
dfs_release(obj);
|
||||||
|
|
||||||
if (test->filePerProc == TRUE) {
|
if (hints->filePerProc == TRUE) {
|
||||||
MPI_CHECK(MPI_Allreduce(&fsize, &tmpSum, 1,
|
MPI_CHECK(MPI_Allreduce(&fsize, &tmpSum, 1,
|
||||||
MPI_LONG_LONG_INT, MPI_SUM, comm),
|
MPI_LONG_LONG_INT, MPI_SUM, comm),
|
||||||
"cannot total data moved");
|
"cannot total data moved");
|
||||||
|
@ -770,13 +796,13 @@ DFS_GetFileSize(IOR_param_t * test, MPI_Comm comm, char *testFileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
DFS_Statfs(const char *path, ior_aiori_statfs_t *sfs, IOR_param_t * param)
|
DFS_Statfs(const char *path, ior_aiori_statfs_t *sfs, aiori_mod_opt_t * param)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
DFS_Mkdir(const char *path, mode_t mode, IOR_param_t * param)
|
DFS_Mkdir(const char *path, mode_t mode, aiori_mod_opt_t * param)
|
||||||
{
|
{
|
||||||
dfs_obj_t *parent = NULL;
|
dfs_obj_t *parent = NULL;
|
||||||
char *name = NULL, *dir_name = NULL;
|
char *name = NULL, *dir_name = NULL;
|
||||||
|
@ -804,7 +830,7 @@ DFS_Mkdir(const char *path, mode_t mode, IOR_param_t * param)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
DFS_Rmdir(const char *path, IOR_param_t * param)
|
DFS_Rmdir(const char *path, aiori_mod_opt_t * param)
|
||||||
{
|
{
|
||||||
dfs_obj_t *parent = NULL;
|
dfs_obj_t *parent = NULL;
|
||||||
char *name = NULL, *dir_name = NULL;
|
char *name = NULL, *dir_name = NULL;
|
||||||
|
@ -833,7 +859,7 @@ DFS_Rmdir(const char *path, IOR_param_t * param)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
DFS_Access(const char *path, int mode, IOR_param_t * param)
|
DFS_Access(const char *path, int mode, aiori_mod_opt_t * param)
|
||||||
{
|
{
|
||||||
dfs_obj_t *obj = NULL;
|
dfs_obj_t *obj = NULL;
|
||||||
mode_t fmode;
|
mode_t fmode;
|
||||||
|
@ -850,7 +876,7 @@ DFS_Access(const char *path, int mode, IOR_param_t * param)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
DFS_Stat(const char *path, struct stat *buf, IOR_param_t * param)
|
DFS_Stat(const char *path, struct stat *buf, aiori_mod_opt_t * param)
|
||||||
{
|
{
|
||||||
dfs_obj_t *parent = NULL;
|
dfs_obj_t *parent = NULL;
|
||||||
char *name = NULL, *dir_name = NULL;
|
char *name = NULL, *dir_name = NULL;
|
||||||
|
|
Loading…
Reference in New Issue