Skip to content

Commit f9c0cc3

Browse files
Merge pull request #473 from glennklockwood/4.0
Pull DAOS fixes into 4.0 release stream
2 parents 798b954 + ac410f2 commit f9c0cc3

File tree

1 file changed

+33
-66
lines changed

1 file changed

+33
-66
lines changed

src/aiori-DFS.c

Lines changed: 33 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,28 @@ enum handleType {
6363
CONT_HANDLE,
6464
DFS_HANDLE
6565
};
66+
/**************************** P R O T O T Y P E S *****************************/
67+
static void DFS_Init(aiori_mod_opt_t *);
68+
static void DFS_Finalize(aiori_mod_opt_t *);
69+
static aiori_fd_t *DFS_Create(char *, int, aiori_mod_opt_t *);
70+
static aiori_fd_t *DFS_Open(char *, int, aiori_mod_opt_t *);
71+
static IOR_offset_t DFS_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t,
72+
IOR_offset_t, aiori_mod_opt_t *);
73+
static void DFS_Close(aiori_fd_t *, aiori_mod_opt_t *);
74+
static void DFS_Delete(char *, aiori_mod_opt_t *);
75+
static char* DFS_GetVersion();
76+
static void DFS_Fsync(aiori_fd_t *, aiori_mod_opt_t *);
77+
static void DFS_Sync(aiori_mod_opt_t *);
78+
static IOR_offset_t DFS_GetFileSize(aiori_mod_opt_t *, char *);
79+
static int DFS_Statfs (const char *, ior_aiori_statfs_t *, aiori_mod_opt_t *);
80+
static int DFS_Stat (const char *, struct stat *, aiori_mod_opt_t *);
81+
static int DFS_Mkdir (const char *, mode_t, aiori_mod_opt_t *);
82+
static int DFS_Rename(const char *, const char *, aiori_mod_opt_t *);
83+
static int DFS_Rmdir (const char *, aiori_mod_opt_t *);
84+
static int DFS_Access (const char *, int, aiori_mod_opt_t *);
85+
static option_help * DFS_options(aiori_mod_opt_t **, aiori_mod_opt_t *);
86+
static void DFS_init_xfer_options(aiori_xfer_hint_t *);
87+
static int DFS_check_params(aiori_mod_opt_t *);
6688

6789
/************************** O P T I O N S *****************************/
6890
typedef struct {
@@ -89,9 +111,9 @@ static option_help * DFS_options(aiori_mod_opt_t ** init_backend_options,
89111
*init_backend_options = (aiori_mod_opt_t *) o;
90112

91113
option_help h [] = {
92-
{0, "dfs.pool", "Pool label or uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o->pool},
114+
{0, "dfs.pool", "Pool label", OPTION_OPTIONAL_ARGUMENT, 's', &o->pool},
93115
{0, "dfs.group", "DAOS system name", OPTION_OPTIONAL_ARGUMENT, 's', &o->group},
94-
{0, "dfs.cont", "Container label or uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o->cont},
116+
{0, "dfs.cont", "Container label", OPTION_OPTIONAL_ARGUMENT, 's', &o->cont},
95117
{0, "dfs.chunk_size", "File chunk size in bytes (e.g.: 8, 4k, 2m, 1g)", OPTION_OPTIONAL_ARGUMENT, 'd', &o->chunk_size},
96118
{0, "dfs.oclass", "File object class", OPTION_OPTIONAL_ARGUMENT, 's', &o->oclass},
97119
{0, "dfs.dir_oclass", "Directory object class", OPTION_OPTIONAL_ARGUMENT, 's',
@@ -106,28 +128,6 @@ static option_help * DFS_options(aiori_mod_opt_t ** init_backend_options,
106128
return help;
107129
}
108130

109-
/**************************** P R O T O T Y P E S *****************************/
110-
static void DFS_Init(aiori_mod_opt_t *);
111-
static void DFS_Finalize(aiori_mod_opt_t *);
112-
static aiori_fd_t *DFS_Create(char *, int, aiori_mod_opt_t *);
113-
static aiori_fd_t *DFS_Open(char *, int, aiori_mod_opt_t *);
114-
static IOR_offset_t DFS_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t,
115-
IOR_offset_t, aiori_mod_opt_t *);
116-
static void DFS_Close(aiori_fd_t *, aiori_mod_opt_t *);
117-
static void DFS_Delete(char *, aiori_mod_opt_t *);
118-
static char* DFS_GetVersion();
119-
static void DFS_Fsync(aiori_fd_t *, aiori_mod_opt_t *);
120-
static void DFS_Sync(aiori_mod_opt_t *);
121-
static IOR_offset_t DFS_GetFileSize(aiori_mod_opt_t *, char *);
122-
static int DFS_Statfs (const char *, ior_aiori_statfs_t *, aiori_mod_opt_t *);
123-
static int DFS_Stat (const char *, struct stat *, aiori_mod_opt_t *);
124-
static int DFS_Mkdir (const char *, mode_t, aiori_mod_opt_t *);
125-
static int DFS_Rename(const char *, const char *, aiori_mod_opt_t *);
126-
static int DFS_Rmdir (const char *, aiori_mod_opt_t *);
127-
static int DFS_Access (const char *, int, aiori_mod_opt_t *);
128-
static option_help * DFS_options();
129-
static void DFS_init_xfer_options(aiori_xfer_hint_t *);
130-
static int DFS_check_params(aiori_mod_opt_t *);
131131

132132
/************************** D E C L A R A T I O N S ***************************/
133133

@@ -172,7 +172,7 @@ do { \
172172
} \
173173
} while (0)
174174

175-
#define INFO(level, format, ...) \
175+
#define DINFO(level, format, ...) \
176176
do { \
177177
if (verbose >= level) \
178178
printf("[%d] "format"\n", rank, ##__VA_ARGS__); \
@@ -462,7 +462,6 @@ DFS_Init(aiori_mod_opt_t * options)
462462
{
463463
DFS_options_t *o = (DFS_options_t *)options;
464464
bool pool_connect, cont_create, cont_open, dfs_mounted;
465-
uuid_t co_uuid;
466465
int rc;
467466

468467
dfs_init_count++;
@@ -513,45 +512,23 @@ DFS_Init(aiori_mod_opt_t * options)
513512
daos_pool_info_t pool_info;
514513
daos_cont_info_t co_info;
515514

516-
INFO(VERBOSE_1, "DFS Pool = %s", o->pool);
517-
INFO(VERBOSE_1, "DFS Container = %s", o->cont);
515+
DINFO(VERBOSE_1, "DFS Pool = %s", o->pool);
516+
DINFO(VERBOSE_1, "DFS Container = %s", o->cont);
518517

519-
#if CHECK_DAOS_API_VERSION(1, 4)
520518
rc = daos_pool_connect(o->pool, o->group, DAOS_PC_RW, &poh, &pool_info, NULL);
521519
DCHECK(rc, "Failed to connect to pool %s", o->pool);
522520
pool_connect = true;
523521

524522
rc = daos_cont_open(poh, o->cont, DAOS_COO_RW, &coh, &co_info, NULL);
525-
#else
526-
uuid_t pool_uuid;
527-
528-
rc = uuid_parse(o->pool, pool_uuid);
529-
DCHECK(rc, "Failed to parse 'Pool uuid': %s", o->pool);
530-
rc = uuid_parse(o->cont, co_uuid);
531-
DCHECK(rc, "Failed to parse 'Cont uuid': %s", o->cont);
532-
533-
rc = daos_pool_connect(pool_uuid, o->group, DAOS_PC_RW, &poh, &pool_info, NULL);
534-
DCHECK(rc, "Failed to connect to pool %s", o->pool);
535-
pool_connect = true;
536-
537-
rc = daos_cont_open(poh, co_uuid, DAOS_COO_RW, &coh, &co_info, NULL);
538-
#endif
539523
/* If NOEXIST we create it */
540524
if (rc == -DER_NONEXIST) {
541-
INFO(VERBOSE_1, "Creating DFS Container ...\n");
542-
#if CHECK_DAOS_API_VERSION(1, 4)
543-
if (uuid_parse(o->cont, co_uuid) != 0)
544-
/** user passes in label */
545-
rc = dfs_cont_create_with_label(poh, o->cont, NULL, &co_uuid, &coh, NULL);
546-
else
547-
/** user passes in uuid */
548-
#endif
549-
rc = dfs_cont_create(poh, co_uuid, NULL, &coh, NULL);
525+
DINFO(VERBOSE_1, "Creating DFS Container ...\n");
526+
rc = dfs_cont_create_with_label(poh, o->cont, NULL, NULL, &coh, NULL);
550527
if (rc)
551528
DCHECK(rc, "Failed to create container");
552529
cont_create = true;
553530
} else if (rc) {
554-
DCHECK(rc, "Failed to create container");
531+
DCHECK(rc, "Failed to open container %s", o->cont);
555532
}
556533
cont_open = true;
557534

@@ -579,11 +556,7 @@ DFS_Init(aiori_mod_opt_t * options)
579556
if (cont_open)
580557
daos_cont_close(coh, NULL);
581558
if (cont_create && rank == 0) {
582-
#if CHECK_DAOS_API_VERSION(1, 4)
583559
daos_cont_destroy(poh, o->cont, 1, NULL);
584-
#else
585-
daos_cont_destroy(poh, co_uuid, 1, NULL);
586-
#endif
587560
}
588561
if (pool_connect)
589562
daos_pool_disconnect(poh, NULL);
@@ -633,14 +606,8 @@ DFS_Finalize(aiori_mod_opt_t *options)
633606

634607
if (o->destroy) {
635608
if (rank == 0) {
636-
INFO(VERBOSE_1, "Destroying DFS Container: %s", o->cont);
637-
#if CHECK_DAOS_API_VERSION(1, 4)
609+
DINFO(VERBOSE_1, "Destroying DFS Container: %s", o->cont);
638610
daos_cont_destroy(poh, o->cont, 1, NULL);
639-
#else
640-
uuid_t uuid;
641-
uuid_parse(o->cont, uuid);
642-
rc = daos_cont_destroy(poh, uuid, 1, NULL);
643-
#endif
644611
DCHECK(rc, "Failed to destroy container %s", o->cont);
645612
}
646613

@@ -652,15 +619,15 @@ DFS_Finalize(aiori_mod_opt_t *options)
652619
}
653620

654621
if (rank == 0)
655-
INFO(VERBOSE_1, "Disconnecting from DAOS POOL");
622+
DINFO(VERBOSE_1, "Disconnecting from DAOS POOL");
656623

657624
rc = daos_pool_disconnect(poh, NULL);
658625
DCHECK(rc, "Failed to disconnect from pool");
659626

660627
MPI_CHECK(MPI_Barrier(testComm), "barrier error");
661628

662629
if (rank == 0)
663-
INFO(VERBOSE_1, "Finalizing DAOS..");
630+
DINFO(VERBOSE_1, "Finalizing DAOS..");
664631

665632
rc = daos_fini();
666633
DCHECK(rc, "Failed to finalize DAOS");

0 commit comments

Comments
 (0)