From 3623f3b8bdf56d49f9307682c15fbbcffcd58a16 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Sun, 31 May 2020 16:20:58 +0000 Subject: [PATCH 1/3] 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) From 3eb488939ddb42434afad5e741e17b8564644582 Mon Sep 17 00:00:00 2001 From: Sven Breuner Date: Wed, 3 Jun 2020 00:30:38 +0300 Subject: [PATCH 2/3] mdtest: allocate aligned buffers to support DirectIO --- src/mdtest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mdtest.c b/src/mdtest.c index f82db1b..c8a8b47 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -633,8 +633,8 @@ void mdtest_read(int random, int dirs, const long dir_iter, char *path) { /* allocate read buffer */ if (read_bytes > 0) { - read_buffer = (char *)malloc(read_bytes); - if (read_buffer == NULL) { + int alloc_res = posix_memalign((void**)&read_buffer, sysconf(_SC_PAGESIZE), write_bytes); + if (alloc_res) { FAIL("out of memory"); } @@ -2125,8 +2125,8 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * /* allocate and initialize write buffer with # */ if (write_bytes > 0) { - write_buffer = (char *)malloc(write_bytes); - if (write_buffer == NULL) { + int alloc_res = posix_memalign((void**)&write_buffer, sysconf(_SC_PAGESIZE), write_bytes); + if (alloc_res) { FAIL("out of memory"); } generate_memory_pattern(write_buffer, write_bytes); From c828a0f32c50c8644832b6fab21974880860e415 Mon Sep 17 00:00:00 2001 From: Sven Breuner Date: Wed, 3 Jun 2020 01:22:44 +0300 Subject: [PATCH 3/3] mdtest: use correct number of bytes for posix_memalign of read buffer Fixes a typo in initial posix_memalign commit for DirectIO support. --- src/mdtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mdtest.c b/src/mdtest.c index c8a8b47..105837f 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -633,7 +633,7 @@ void mdtest_read(int random, int dirs, const long dir_iter, char *path) { /* allocate read buffer */ if (read_bytes > 0) { - int alloc_res = posix_memalign((void**)&read_buffer, sysconf(_SC_PAGESIZE), write_bytes); + int alloc_res = posix_memalign((void**)&read_buffer, sysconf(_SC_PAGESIZE), read_bytes); if (alloc_res) { FAIL("out of memory"); }