From e3db1759b2736aaef826dae756283bfd7e58a1ee Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sun, 1 Sep 2019 15:47:42 +0100 Subject: [PATCH] Moded sync() to aiori backend. --- src/aiori-POSIX.c | 12 ++++++++++++ src/aiori.h | 1 + src/mdtest.c | 5 ++++- src/utilities.c | 7 ------- src/utilities.h | 1 - 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index 00e974c..99a68f1 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -71,6 +71,7 @@ static IOR_offset_t POSIX_Xfer(int, void *, IOR_size_t *, IOR_offset_t, IOR_param_t *); static void POSIX_Fsync(void *, IOR_param_t *); +static void POSIX_Sync(IOR_param_t * ); /************************** O P T I O N S *****************************/ typedef struct{ @@ -122,6 +123,7 @@ ior_aiori_t posix_aiori = { .stat = aiori_posix_stat, .get_options = POSIX_options, .enable_mdtest = true, + .sync = POSIX_Sync }; /***************************** F U N C T I O N S ******************************/ @@ -588,6 +590,16 @@ static void POSIX_Fsync(void *fd, IOR_param_t * param) EWARNF("fsync(%d) failed", *(int *)fd); } + +static void POSIX_Sync(IOR_param_t * param) +{ + int ret = system("sync"); + if (ret != 0){ + FAIL("Error executing the sync command, ensure it exists."); + } +} + + /* * Close a file through the POSIX interface. */ diff --git a/src/aiori.h b/src/aiori.h index c2074c2..8a5e207 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -86,6 +86,7 @@ typedef struct ior_aiori { void (*finalize)(); /* called once per program after MPI is shutdown */ option_help * (*get_options)(void ** init_backend_options, void* init_values); /* initializes the backend options as well and returns the pointer to the option help structure */ bool enable_mdtest; + void (*sync)(IOR_param_t * ); /* synchronize every pending operation for this storage */ } ior_aiori_t; enum bench_type { diff --git a/src/mdtest.c b/src/mdtest.c index e34496a..52efa34 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -266,7 +266,10 @@ static void prep_testdir(int j, int dir_iter){ static void phase_end(){ if (call_sync){ - call_sync_cmd(); + if(! backend->sync){ + FAIL("Error, backend does not provide the sync method, but your requested to use sync."); + } + backend->sync(& param); } if (barriers) { diff --git a/src/utilities.c b/src/utilities.c index a2e4b0d..c7e1c8c 100755 --- a/src/utilities.c +++ b/src/utilities.c @@ -809,10 +809,3 @@ char *HumanReadable(IOR_offset_t value, int base) } return valueStr; } - -void call_sync_cmd(){ - int ret = system("sync"); - if (ret != 0){ - FAIL("Error executing the sync command, ensure it exists."); - } -} diff --git a/src/utilities.h b/src/utilities.h index b85f957..d2c9962 100755 --- a/src/utilities.h +++ b/src/utilities.h @@ -60,7 +60,6 @@ int QueryNodeMapping(MPI_Comm comm, int print_nodemap); void DelaySecs(int delay); void updateParsedOptions(IOR_param_t * options, options_all_t * global_options); size_t NodeMemoryStringToBytes(char *size_str); -void call_sync_cmd(); /* Returns -1, if cannot be read */ int64_t ReadStoneWallingIterations(char * const filename);