From 3623f3b8bdf56d49f9307682c15fbbcffcd58a16 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Sun, 31 May 2020 16:20:58 +0000 Subject: [PATCH] DFS: allow multiple IO phases when ior_run() is called - init/fini can be made multiple times - reset tunables on fini so they can change on a re-init Signed-off-by: Mohamad Chaarawi --- src/aiori-DAOS.c | 4 +--- src/aiori-DFS.c | 29 +++++++++++++++++++++++++---- src/ior.c | 2 ++ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/aiori-DAOS.c b/src/aiori-DAOS.c index 7f07f7c..8fa1578 100644 --- a/src/aiori-DAOS.c +++ b/src/aiori-DAOS.c @@ -216,10 +216,8 @@ DAOS_Init() if (daos_initialized) return; - if (o.pool == NULL || o.svcl == NULL || o.cont == NULL) { - GERR("Invalid DAOS pool/cont\n"); + if (o.pool == NULL || o.svcl == NULL || o.cont == NULL) return; - } if (o.oclass) { objectClass = daos_oclass_name2id(o.oclass); diff --git a/src/aiori-DFS.c b/src/aiori-DFS.c index 6487488..e7b1d6b 100755 --- a/src/aiori-DFS.c +++ b/src/aiori-DFS.c @@ -42,6 +42,7 @@ static daos_handle_t poh, coh; static daos_oclass_id_t objectClass = OC_SX; static daos_oclass_id_t dir_oclass = OC_SX; static struct d_hash_table *dir_hash; +static bool dfs_init; struct aiori_dir_hdl { d_list_t entry; @@ -386,8 +387,16 @@ static void DFS_Init() { int rc; + /** in case we are already initialized, return */ + if (dfs_init) + return; + + /** shouldn't be fatal since it can be called with POSIX backend selection */ if (o.pool == NULL || o.svcl == NULL || o.cont == NULL) - ERR("Invalid pool or container options\n"); + return; + + rc = daos_init(); + DCHECK(rc, "Failed to initialize daos"); if (o.oclass) { objectClass = daos_oclass_name2id(o.oclass); @@ -401,9 +410,6 @@ DFS_Init() { GERR("Invalid DAOS directory object class %s\n", o.dir_oclass); } - rc = daos_init(); - DCHECK(rc, "Failed to initialize daos"); - rc = d_hash_table_create(0, 16, NULL, &hdl_hash_ops, &dir_hash); DCHECK(rc, "Failed to initialize dir hashtable"); @@ -457,6 +463,7 @@ DFS_Init() { rc = dfs_set_prefix(dfs, o.prefix); DCHECK(rc, "Failed to set DFS Prefix"); } + dfs_init = true; } static void @@ -510,6 +517,20 @@ DFS_Finalize() rc = daos_fini(); DCHECK(rc, "Failed to finalize DAOS"); + + /** reset tunables */ + o.pool = NULL; + o.svcl = NULL; + o.group = NULL; + o.cont = NULL; + o.chunk_size = 1048576; + o.oclass = NULL; + o.dir_oclass = NULL; + o.prefix = NULL; + o.destroy = 0; + objectClass = OC_SX; + dir_oclass = OC_SX; + dfs_init = false; } /* diff --git a/src/ior.c b/src/ior.c index 05070b0..361a9a4 100755 --- a/src/ior.c +++ b/src/ior.c @@ -1625,6 +1625,8 @@ static void ValidateTests(IOR_param_t * test) && (strcasecmp(test->api, "MPIIO") != 0) && (strcasecmp(test->api, "MMAP") != 0) && (strcasecmp(test->api, "HDFS") != 0) + && (strcasecmp(test->api, "DFS") != 0) + && (strcasecmp(test->api, "DAOS") != 0) && (strcasecmp(test->api, "Gfarm") != 0) && (strcasecmp(test->api, "RADOS") != 0) && (strcasecmp(test->api, "CEPHFS") != 0)) && test->fsync)