From 294b8891e69b88c62e431d9d5600bfb0571dc58e Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sun, 31 May 2020 11:50:15 +0100 Subject: [PATCH] Created dummy option type to provide type safety. Fixed various call issues for options. --- src/aiori-DUMMY.c | 40 +++++++-------- src/aiori-HDF5.c | 48 +++++++++--------- src/aiori-MMAP.c | 30 +++++------ src/aiori-MPIIO.c | 125 ++++++++++++++++++++++++---------------------- src/aiori-POSIX.c | 30 +++++------ src/aiori.c | 10 ++-- src/aiori.h | 68 +++++++++++++------------ src/ior.c | 41 ++++++++------- src/ior.h | 6 +-- src/mdtest.c | 4 +- src/option.h | 4 +- 11 files changed, 205 insertions(+), 201 deletions(-) diff --git a/src/aiori-DUMMY.c b/src/aiori-DUMMY.c index c58a128..766a2c0 100755 --- a/src/aiori-DUMMY.c +++ b/src/aiori-DUMMY.c @@ -25,7 +25,7 @@ typedef struct { static char * current = (char*) 1; -static option_help * DUMMY_options(void ** init_backend_options, void * init_values){ +static option_help * DUMMY_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ dummy_options_t * o = malloc(sizeof(dummy_options_t)); if (init_values != NULL){ memcpy(o, init_values, sizeof(dummy_options_t)); @@ -33,7 +33,7 @@ static option_help * DUMMY_options(void ** init_backend_options, void * init_val memset(o, 0, sizeof(dummy_options_t)); } - *init_backend_options = o; + *init_backend_options = (airori_mod_opt_t*) o; option_help h [] = { {0, "dummy.delay-create", "Delay per create in usec", OPTION_OPTIONAL_ARGUMENT, 'l', & o->delay_creates}, @@ -48,7 +48,7 @@ static option_help * DUMMY_options(void ** init_backend_options, void * init_val static int count_init = 0; -static void *DUMMY_Create(char *testFileName, int iorflags, void * param) +static void *DUMMY_Create(char *testFileName, int iorflags, airori_mod_opt_t * options) { if(count_init <= 0){ ERR("DUMMY missing initialization in create\n"); @@ -56,7 +56,7 @@ static void *DUMMY_Create(char *testFileName, int iorflags, void * param) if(verbose > 4){ fprintf(out_logfile, "DUMMY create: %s = %p\n", testFileName, current); } - dummy_options_t * o = (dummy_options_t*) param; + dummy_options_t * o = (dummy_options_t*) options; if (o->delay_creates){ if (! o->delay_rank_0_only || (o->delay_rank_0_only && rank == 0)){ struct timespec wait = { o->delay_creates / 1000 / 1000, 1000l * (o->delay_creates % 1000000)}; @@ -66,7 +66,7 @@ static void *DUMMY_Create(char *testFileName, int iorflags, void * param) return current++; } -static void *DUMMY_Open(char *testFileName, int flags, void * param) +static void *DUMMY_Open(char *testFileName, int flags, airori_mod_opt_t * options) { if(count_init <= 0){ ERR("DUMMY missing initialization in open\n"); @@ -77,7 +77,7 @@ static void *DUMMY_Open(char *testFileName, int flags, void * param) return current++; } -static void DUMMY_Fsync(void *fd, void * param) +static void DUMMY_Fsync(void *fd, airori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY fsync %p\n", fd); @@ -85,18 +85,18 @@ static void DUMMY_Fsync(void *fd, void * param) } -static void DUMMY_Sync(void * param) +static void DUMMY_Sync(airori_mod_opt_t * options) { } -static void DUMMY_Close(void *fd, void * param) +static void DUMMY_Close(void *fd, airori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY close %p\n", fd); } } -static void DUMMY_Delete(char *testFileName, void * param) +static void DUMMY_Delete(char *testFileName, airori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY delete: %s\n", testFileName); @@ -108,7 +108,7 @@ static char * DUMMY_getVersion() return "0.5"; } -static IOR_offset_t DUMMY_GetFileSize(void * test, MPI_Comm testComm, char *testFileName) +static IOR_offset_t DUMMY_GetFileSize(airori_mod_opt_t * options, MPI_Comm testComm, char *testFileName) { if(verbose > 4){ fprintf(out_logfile, "DUMMY getFileSize: %s\n", testFileName); @@ -116,11 +116,11 @@ static IOR_offset_t DUMMY_GetFileSize(void * test, MPI_Comm testComm, char *test return 0; } -static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, void * param){ +static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, airori_mod_opt_t * options){ if(verbose > 4){ fprintf(out_logfile, "DUMMY xfer: %p\n", file); } - dummy_options_t * o = (dummy_options_t*) param; + dummy_options_t * o = (dummy_options_t*) options; if (o->delay_xfer){ if (! o->delay_rank_0_only || (o->delay_rank_0_only && rank == 0)){ struct timespec wait = {o->delay_xfer / 1000 / 1000, 1000l * (o->delay_xfer % 1000000)}; @@ -130,7 +130,7 @@ static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_ return length; } -static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, void * param){ +static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, airori_mod_opt_t * options){ stat->f_bsize = 1; stat->f_blocks = 1; stat->f_bfree = 1; @@ -140,32 +140,32 @@ static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, void * pa return 0; } -static int DUMMY_mkdir (const char *path, mode_t mode, void * param){ +static int DUMMY_mkdir (const char *path, mode_t mode, airori_mod_opt_t * options){ return 0; } -static int DUMMY_rmdir (const char *path, void * param){ +static int DUMMY_rmdir (const char *path, airori_mod_opt_t * options){ return 0; } -static int DUMMY_access (const char *path, int mode, void * param){ +static int DUMMY_access (const char *path, int mode, airori_mod_opt_t * options){ return 0; } -static int DUMMY_stat (const char *path, struct stat *buf, void * param){ +static int DUMMY_stat (const char *path, struct stat *buf, airori_mod_opt_t * options){ return 0; } -static int DUMMY_check_params(void * test){ +static int DUMMY_check_params(airori_mod_opt_t * options){ return 0; } -static void DUMMY_init(void * options){ +static void DUMMY_init(airori_mod_opt_t * options){ WARN("DUMMY initialized"); count_init++; } -static void DUMMY_final(void * options){ +static void DUMMY_final(airori_mod_opt_t * options){ WARN("DUMMY finalized"); if(count_init <= 0){ ERR("DUMMY invalid finalization\n"); diff --git a/src/aiori-HDF5.c b/src/aiori-HDF5.c index 85a6e19..e66e5d4 100755 --- a/src/aiori-HDF5.c +++ b/src/aiori-HDF5.c @@ -81,20 +81,20 @@ #endif /* H5_VERS_MAJOR > 1 && H5_VERS_MINOR > 6 */ /**************************** P R O T O T Y P E S *****************************/ -static IOR_offset_t SeekOffset(void *, IOR_offset_t, void *); -static void SetupDataSet(void *, void *); -static void *HDF5_Create(char *, int flags, void *); -static void *HDF5_Open(char *, int flags, void *); +static IOR_offset_t SeekOffset(void *, IOR_offset_t, airori_mod_opt_t *); +static void SetupDataSet(void *, airori_mod_opt_t *); +static void *HDF5_Create(char *, int flags, airori_mod_opt_t *); +static void *HDF5_Open(char *, int flags, airori_mod_opt_t *); static IOR_offset_t HDF5_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, void *); -static void HDF5_Close(void *, void *); -static void HDF5_Delete(char *, void *); + IOR_offset_t, airori_mod_opt_t *); +static void HDF5_Close(void *, airori_mod_opt_t *); +static void HDF5_Delete(char *, airori_mod_opt_t *); static char* HDF5_GetVersion(); -static void HDF5_Fsync(void *, void *); -static IOR_offset_t HDF5_GetFileSize(void *, MPI_Comm, char *); -static int HDF5_Access(const char *, int, void *); +static void HDF5_Fsync(void *, airori_mod_opt_t *); +static IOR_offset_t HDF5_GetFileSize(airori_mod_opt_t *, MPI_Comm, char *); +static int HDF5_Access(const char *, int, airori_mod_opt_t *); static void HDF5_init_xfer_options(IOR_param_t * params); -static int HDF5_check_params(void * options); +static int HDF5_check_params(airori_mod_opt_t * options); /************************** O P T I O N S *****************************/ typedef struct{ @@ -107,7 +107,7 @@ typedef struct{ } HDF5_options_t; /***************************** F U N C T I O N S ******************************/ -static option_help * HDF5_options(void ** init_backend_options, void * init_values){ +static option_help * HDF5_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ HDF5_options_t * o = malloc(sizeof(HDF5_options_t)); if (init_values != NULL){ @@ -119,7 +119,7 @@ static option_help * HDF5_options(void ** init_backend_options, void * init_valu o->setAlignment = 1; } - *init_backend_options = o; + *init_backend_options = (airori_mod_opt_t*) o; option_help h [] = { {0, "hdf5.collectiveMetadata", "Use collectiveMetadata (available since HDF5-1.10.0)", OPTION_FLAG, 'd', & o->collective_md}, @@ -173,7 +173,7 @@ static void HDF5_init_xfer_options(IOR_param_t * params){ ior_param = params; } -static int HDF5_check_params(void * options){ +static int HDF5_check_params(airori_mod_opt_t * options){ HDF5_options_t *o = (HDF5_options_t*) options; if (o->setAlignment < 0) ERR("alignment must be non-negative integer"); @@ -197,7 +197,7 @@ static int HDF5_check_params(void * options){ /* * Create and open a file through the HDF5 interface. */ -static void *HDF5_Create(char *testFileName, int flags, void * param) +static void *HDF5_Create(char *testFileName, int flags, airori_mod_opt_t * param) { return HDF5_Open(testFileName, flags, param); } @@ -205,7 +205,7 @@ static void *HDF5_Create(char *testFileName, int flags, void * param) /* * Open a file through the HDF5 interface. */ -static void *HDF5_Open(char *testFileName, int flags, void * param) +static void *HDF5_Open(char *testFileName, int flags, airori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; hid_t accessPropList, createPropList; @@ -417,7 +417,7 @@ static void *HDF5_Open(char *testFileName, int flags, void * param) * Write or read access to file using the HDF5 interface. */ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, - IOR_offset_t length, void * param) + IOR_offset_t length, airori_mod_opt_t * param) { static int firstReadCheck = FALSE, startNewDataSet; IOR_offset_t segmentPosition, segmentSize; @@ -495,7 +495,7 @@ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, /* * Perform fsync(). */ -static void HDF5_Fsync(void *fd, void * param) +static void HDF5_Fsync(void *fd, airori_mod_opt_t * param) { ; } @@ -503,7 +503,7 @@ static void HDF5_Fsync(void *fd, void * param) /* * Close a file through the HDF5 interface. */ -static void HDF5_Close(void *fd, void * param) +static void HDF5_Close(void *fd, airori_mod_opt_t * param) { if(ior_param->dryRun) return; @@ -524,7 +524,7 @@ static void HDF5_Close(void *fd, void * param) /* * Delete a file through the HDF5 interface. */ -static void HDF5_Delete(char *testFileName, void * param) +static void HDF5_Delete(char *testFileName, airori_mod_opt_t * param) { if(ior_param->dryRun) return @@ -558,7 +558,7 @@ static char * HDF5_GetVersion() * Seek to offset in file using the HDF5 interface and set up hyperslab. */ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, - void * param) + airori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; IOR_offset_t segmentSize; @@ -598,7 +598,7 @@ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, /* * Create HDF5 data set. */ -static void SetupDataSet(void *fd, void * param) +static void SetupDataSet(void *fd, airori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; char dataSetName[MAX_STR]; @@ -661,7 +661,7 @@ static void SetupDataSet(void *fd, void * param) * Use MPIIO call to get file size. */ static IOR_offset_t -HDF5_GetFileSize(void * test, MPI_Comm testComm, char *testFileName) +HDF5_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) { if(ior_param->dryRun) return 0; @@ -671,7 +671,7 @@ HDF5_GetFileSize(void * test, MPI_Comm testComm, char *testFileName) /* * Use MPIIO call to check for access. */ -static int HDF5_Access(const char *path, int mode, void *param) +static int HDF5_Access(const char *path, int mode, airori_mod_opt_t *param) { if(ior_param->dryRun) return 0; diff --git a/src/aiori-MMAP.c b/src/aiori-MMAP.c index 10c196e..81e7a81 100644 --- a/src/aiori-MMAP.c +++ b/src/aiori-MMAP.c @@ -26,15 +26,15 @@ #include "utilities.h" /**************************** P R O T O T Y P E S *****************************/ -static void *MMAP_Create(char *, int flags, void *); -static void *MMAP_Open(char *, int flags, void *); +static void *MMAP_Create(char *, int flags, airori_mod_opt_t *); +static void *MMAP_Open(char *, int flags, airori_mod_opt_t *); static IOR_offset_t MMAP_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, void *); -static void MMAP_Close(void *, void *); -static void MMAP_Fsync(void *, void *); -static option_help * MMAP_options(void ** init_backend_options, void * init_values); + IOR_offset_t, airori_mod_opt_t *); +static void MMAP_Close(void *, airori_mod_opt_t *); +static void MMAP_Fsync(void *, airori_mod_opt_t *); +static option_help * MMAP_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values); static void MMAP_init_xfer_options(IOR_param_t * params); -static int MMAP_check_params(void * options); +static int MMAP_check_params(airori_mod_opt_t * options); /************************** D E C L A R A T I O N S ***************************/ ior_aiori_t mmap_aiori = { @@ -61,7 +61,7 @@ typedef struct{ int madv_pattern; } mmap_options_t; -static option_help * MMAP_options(void ** init_backend_options, void * init_values){ +static option_help * MMAP_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ mmap_options_t * o = malloc(sizeof(mmap_options_t)); if (init_values != NULL){ @@ -70,7 +70,7 @@ static option_help * MMAP_options(void ** init_backend_options, void * init_valu memset(o, 0, sizeof(mmap_options_t)); } - *init_backend_options = o; + *init_backend_options = (airori_mod_opt_t*) o; option_help h [] = { {0, "mmap.madv_dont_need", "Use advise don't need", OPTION_FLAG, 'd', & o->madv_dont_need}, @@ -89,7 +89,7 @@ static void MMAP_init_xfer_options(IOR_param_t * params){ aiori_posix_init_xfer_options(params); } -static int MMAP_check_params(void * options){ +static int MMAP_check_params(airori_mod_opt_t * options){ if (ior_param->fsyncPerWrite && (ior_param->transferSize & (sysconf(_SC_PAGESIZE) - 1))) ERR("transfer size must be aligned with PAGESIZE for MMAP with fsyncPerWrite"); return 0; @@ -130,7 +130,7 @@ static void ior_mmap_file(int *file, int mflags, void *param) /* * Creat and open a file through the POSIX interface, then setup mmap. */ -static void *MMAP_Create(char *testFileName, int flags, void * param) +static void *MMAP_Create(char *testFileName, int flags, airori_mod_opt_t * param) { int *fd; @@ -144,7 +144,7 @@ static void *MMAP_Create(char *testFileName, int flags, void * param) /* * Open a file through the POSIX interface and setup mmap. */ -static void *MMAP_Open(char *testFileName, int flags, void * param) +static void *MMAP_Open(char *testFileName, int flags, airori_mod_opt_t * param) { int *fd; fd = POSIX_Open(testFileName, flags, param); @@ -156,7 +156,7 @@ static void *MMAP_Open(char *testFileName, int flags, void * param) * Write or read access to file using mmap */ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, - IOR_offset_t length, void * param) + IOR_offset_t length, airori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (access == WRITE) { @@ -178,7 +178,7 @@ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform msync(). */ -static void MMAP_Fsync(void *fd, void * param) +static void MMAP_Fsync(void *fd, airori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (msync(o->mmap_ptr, ior_param->expectedAggFileSize, MS_SYNC) != 0) @@ -188,7 +188,7 @@ static void MMAP_Fsync(void *fd, void * param) /* * Close a file through the POSIX interface, after tear down the mmap. */ -static void MMAP_Close(void *fd, void * param) +static void MMAP_Close(void *fd, airori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (munmap(o->mmap_ptr, ior_param->expectedAggFileSize) != 0) diff --git a/src/aiori-MPIIO.c b/src/aiori-MPIIO.c index 5c8a012..6a22170 100755 --- a/src/aiori-MPIIO.c +++ b/src/aiori-MPIIO.c @@ -31,20 +31,26 @@ /**************************** P R O T O T Y P E S *****************************/ -static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, void *); +static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, airori_mod_opt_t *); -static void *MPIIO_Create(char *, int iorflags, void *); -static void *MPIIO_Open(char *, int flags, void *); +static void *MPIIO_Create(char *, int iorflags, airori_mod_opt_t *); +static void *MPIIO_Open(char *, int flags, airori_mod_opt_t *); static IOR_offset_t MPIIO_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, void *); -static void MPIIO_Close(void *, void *); + IOR_offset_t, airori_mod_opt_t *); +static void MPIIO_Close(void *, airori_mod_opt_t *); static char* MPIIO_GetVersion(); -static void MPIIO_Fsync(void *, void *); +static void MPIIO_Fsync(void *, airori_mod_opt_t *); static void MPIIO_init_xfer_options(IOR_param_t * params); -static int MPIIO_check_params(void * options); +static int MPIIO_check_params(airori_mod_opt_t * options); /************************** D E C L A R A T I O N S ***************************/ +typedef struct{ + MPI_File fd; + MPI_Datatype transferType; /* datatype for transfer */ + MPI_Datatype fileType; /* filetype for file view */ +} mpiio_fd_t; + typedef struct { int dry_run; int showHints; /* show hints */ @@ -55,14 +61,14 @@ typedef struct { char * hintsFileName; /* full name for hints file */ } mpiio_options_t; -static option_help * MPIIO_options(void ** init_backend_options, void * init_values){ +static option_help * MPIIO_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ mpiio_options_t * o = malloc(sizeof(mpiio_options_t)); if (init_values != NULL){ memcpy(o, init_values, sizeof(mpiio_options_t)); }else{ memset(o, 0, sizeof(mpiio_options_t)); } - *init_backend_options = o; + *init_backend_options = (airori_mod_opt_t*) o; option_help h [] = { {0, "mpiio.dryRun", "Dry run, disable actual IO", OPTION_FLAG, 'd', & o->dry_run}, @@ -108,7 +114,7 @@ static void MPIIO_init_xfer_options(IOR_param_t * params){ ior_param = params; } -static int MPIIO_check_params(void * module_options){ +static int MPIIO_check_params(airori_mod_opt_t * module_options){ mpiio_options_t * param = (mpiio_options_t*) module_options; if ((param->useFileView == TRUE) && (sizeof(MPI_Aint) < 8) /* used for 64-bit datatypes */ @@ -134,7 +140,7 @@ static int MPIIO_check_params(void * module_options){ /* * Try to access a file through the MPIIO interface. */ -int MPIIO_Access(const char *path, int mode, void *module_options) +int MPIIO_Access(const char *path, int mode, airori_mod_opt_t *module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run){ @@ -166,7 +172,7 @@ int MPIIO_Access(const char *path, int mode, void *module_options) /* * Create and open a file through the MPIIO interface. */ -static void *MPIIO_Create(char *testFileName, int iorflags, void * module_options) +static void *MPIIO_Create(char *testFileName, int iorflags, airori_mod_opt_t * module_options) { return MPIIO_Open(testFileName, iorflags, module_options); } @@ -174,7 +180,7 @@ static void *MPIIO_Create(char *testFileName, int iorflags, void * module_option /* * Open a file through the MPIIO interface. Setup file view. */ -static void *MPIIO_Open(char *testFileName, int flags, void * module_options) +static void *MPIIO_Open(char *testFileName, int flags, airori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; int fd_mode = (int)0, @@ -184,16 +190,12 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) struct fileTypeStruct { int globalSizes[2], localSizes[2], startIndices[2]; } fileTypeStruct; - MPI_File *fd; + + mpiio_fd_t * mfd = malloc(sizeof(mpiio_fd_t)); + memset(mfd, 0, sizeof(mpiio_fd_t)); MPI_Comm comm; MPI_Info mpiHints = MPI_INFO_NULL; - fd = (MPI_File *) malloc(sizeof(MPI_File)); - if (fd == NULL) - ERR("malloc failed()"); - - *fd = 0; - /* set IOR file flags to MPIIO flags */ /* -- file open flags -- */ if (flags & IOR_RDONLY) { @@ -214,9 +216,6 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) if (flags & IOR_EXCL) { fd_mode |= MPI_MODE_EXCL; } - if (flags & IOR_TRUNC) { - fprintf(stdout, "File truncation not implemented in MPIIO\n"); - } if (flags & IOR_DIRECT) { fprintf(stdout, "O_DIRECT not implemented in MPIIO\n"); } @@ -248,15 +247,18 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) fprintf(stdout, "}\n"); } if(! param->dry_run){ - MPI_CHECKF(MPI_File_open(comm, testFileName, fd_mode, mpiHints, fd), + MPI_CHECKF(MPI_File_open(comm, testFileName, fd_mode, mpiHints, & mfd->fd), "cannot open file: %s", testFileName); + if (flags & IOR_TRUNC) { + MPI_CHECKF(MPI_File_set_size(mfd->fd, 0), "cannot truncate file: %s", testFileName); + } } /* show hints actually attached to file handle */ if (rank == 0 && param->showHints && ! param->dry_run) { if (mpiHints != MPI_INFO_NULL) MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); - MPI_CHECK(MPI_File_get_info(*fd, &mpiHints), + MPI_CHECK(MPI_File_get_info(mfd->fd, &mpiHints), "cannot get file info"); fprintf(stdout, "\nhints returned from opened file {\n"); ShowHints(&mpiHints); @@ -265,7 +267,7 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) /* preallocate space for file */ if (param->preallocate && ior_param->open == WRITE && ! param->dry_run) { - MPI_CHECK(MPI_File_preallocate(*fd, + MPI_CHECK(MPI_File_preallocate(mfd->fd, (MPI_Offset) (ior_param->segmentCount * ior_param->blockSize * @@ -277,9 +279,9 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) /* create contiguous transfer datatype */ MPI_CHECK(MPI_Type_contiguous (ior_param->transferSize / sizeof(IOR_size_t), - MPI_LONG_LONG_INT, &ior_param->transferType), + MPI_LONG_LONG_INT, & mfd->transferType), "cannot create contiguous datatype"); - MPI_CHECK(MPI_Type_commit(&ior_param->transferType), + MPI_CHECK(MPI_Type_commit(& mfd->transferType), "cannot commit datatype"); if (ior_param->filePerProc) { offsetFactor = 0; @@ -305,29 +307,29 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) (2, fileTypeStruct.globalSizes, fileTypeStruct.localSizes, fileTypeStruct.startIndices, MPI_ORDER_C, - ior_param->transferType, &ior_param->fileType), + mfd->transferType, & mfd->fileType), "cannot create subarray"); - MPI_CHECK(MPI_Type_commit(&ior_param->fileType), + MPI_CHECK(MPI_Type_commit(& mfd->fileType), "cannot commit datatype"); if(! param->dry_run){ - MPI_CHECK(MPI_File_set_view(*fd, (MPI_Offset) 0, - ior_param->transferType, - ior_param->fileType, "native", + MPI_CHECK(MPI_File_set_view(mfd->fd, (MPI_Offset) 0, + mfd->transferType, + mfd->fileType, "native", (MPI_Info) MPI_INFO_NULL), "cannot set file view"); } } if (mpiHints != MPI_INFO_NULL) MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); - return ((void *)fd); + return ((void *) mfd); } /* * Write or read access to file using the MPIIO interface. */ -static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, - IOR_offset_t length, void * module_options) +static IOR_offset_t MPIIO_Xfer(int access, void * fdp, IOR_size_t * buffer, + IOR_offset_t length, airori_mod_opt_t * module_options) { /* NOTE: The second arg is (void *) for reads, and (const void *) for writes. Therefore, one of the two sets of assignments below @@ -336,6 +338,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run) return length; + mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; int (MPIAPI * Access) (MPI_File, void *, int, MPI_Datatype, MPI_Status *); @@ -385,7 +388,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, */ if (param->useFileView) { /* find offset in file */ - if (SeekOffset(*(MPI_File *) fd, ior_param->offset, param) < + if (SeekOffset(mfd->fd, ior_param->offset, module_options) < 0) { /* if unsuccessful */ length = -1; @@ -404,14 +407,14 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, if (ior_param->collective) { /* individual, collective call */ MPI_CHECK(Access_all - (*(MPI_File *) fd, buffer, length, - ior_param->transferType, &status), + (mfd->fd, buffer, length, + mfd->transferType, &status), "cannot access collective"); } else { /* individual, noncollective call */ MPI_CHECK(Access - (*(MPI_File *) fd, buffer, length, - ior_param->transferType, &status), + (mfd->fd, buffer, length, + mfd->transferType, &status), "cannot access noncollective"); } length *= ior_param->transferSize; /* for return value in bytes */ @@ -424,7 +427,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, if (param->useSharedFilePointer) { /* find offset in file */ if (SeekOffset - (*(MPI_File *) fd, ior_param->offset, param) < 0) { + (mfd->fd, ior_param->offset, module_options) < 0) { /* if unsuccessful */ length = -1; } else { @@ -443,13 +446,13 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, if (ior_param->collective) { /* explicit, collective call */ MPI_CHECK(Access_at_all - (*(MPI_File *) fd, ior_param->offset, + (mfd->fd, ior_param->offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, collective"); } else { /* explicit, noncollective call */ MPI_CHECK(Access_at - (*(MPI_File *) fd, ior_param->offset, + (mfd->fd, ior_param->offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, noncollective"); } @@ -461,40 +464,40 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, /* * Perform fsync(). */ -static void MPIIO_Fsync(void *fdp, void * module_options) +static void MPIIO_Fsync(void *fdp, airori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run) return; - if (MPI_File_sync(*(MPI_File *)fdp) != MPI_SUCCESS) + mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; + if (MPI_File_sync(mfd->fd) != MPI_SUCCESS) EWARN("fsync() failed"); } /* * Close a file through the MPIIO interface. */ -static void MPIIO_Close(void *fd, void * module_options) +static void MPIIO_Close(void *fdp, airori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; + mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; if(! param->dry_run){ - MPI_CHECK(MPI_File_close((MPI_File *) fd), "cannot close file"); + MPI_CHECK(MPI_File_close(& mfd->fd), "cannot close file"); } - //if ((param->useFileView == TRUE) && (param->fd_fppReadCheck == NULL)) { - // /* - // * need to free the datatype, so done in the close process - // */ - // MPI_CHECK(MPI_Type_free(¶m->fileType), - // "cannot free MPI file datatype"); - // MPI_CHECK(MPI_Type_free(¶m->transferType), - // "cannot free MPI transfer datatype"); - //} - free(fd); + if (param->useFileView == TRUE) { + /* + * need to free the datatype, so done in the close process + */ + MPI_CHECK(MPI_Type_free(& mfd->fileType), "cannot free MPI file datatype"); + MPI_CHECK(MPI_Type_free(& mfd->transferType), "cannot free MPI transfer datatype"); + } + free(fdp); } /* * Delete a file through the MPIIO interface. */ -void MPIIO_Delete(char *testFileName, void * module_options) +void MPIIO_Delete(char *testFileName, airori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run) @@ -519,7 +522,7 @@ static char* MPIIO_GetVersion() * Seek to offset in file using the MPIIO interface. */ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, - void * module_options) + airori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; int offsetFactor, tasksPerFile; @@ -561,7 +564,7 @@ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, * Use MPI_File_get_size() to return aggregate file size. * NOTE: This function is used by the HDF5 and NCMPI backends. */ -IOR_offset_t MPIIO_GetFileSize(void * module_options, MPI_Comm testComm, +IOR_offset_t MPIIO_GetFileSize(airori_mod_opt_t * module_options, MPI_Comm testComm, char *testFileName) { mpiio_options_t * test = (mpiio_options_t*) module_options; diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index b7b01e4..20f37f4 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -69,10 +69,10 @@ /**************************** P R O T O T Y P E S *****************************/ static IOR_offset_t POSIX_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, void *); -static void POSIX_Fsync(void *, void *); -static void POSIX_Sync(void * ); -static int POSIX_check_params(void * options); + IOR_offset_t, airori_mod_opt_t *); +static void POSIX_Fsync(void *, airori_mod_opt_t *); +static void POSIX_Sync(airori_mod_opt_t * ); +static int POSIX_check_params(airori_mod_opt_t * options); /************************** O P T I O N S *****************************/ typedef struct{ @@ -97,7 +97,7 @@ typedef struct{ } posix_options_t; -option_help * POSIX_options(void ** init_backend_options, void * init_values){ +option_help * POSIX_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ posix_options_t * o = malloc(sizeof(posix_options_t)); if (init_values != NULL){ @@ -110,7 +110,7 @@ option_help * POSIX_options(void ** init_backend_options, void * init_values){ o->beegfs_chunkSize = -1; } - *init_backend_options = o; + *init_backend_options = (airori_mod_opt_t*) o; option_help h [] = { {0, "posix.odirect", "Direct I/O Mode", OPTION_FLAG, 'd', & o->direct_io}, @@ -172,7 +172,7 @@ void aiori_posix_init_xfer_options(IOR_param_t * params){ ior_param = params; } -static int POSIX_check_params(void * param){ +static int POSIX_check_params(airori_mod_opt_t * param){ posix_options_t * o = (posix_options_t*) param; if (ior_param->useExistingTestFile && o->lustre_set_striping) ERR("Lustre stripe options are incompatible with useExistingTestFile"); @@ -372,7 +372,7 @@ bool beegfs_createFilePath(char* filepath, mode_t mode, int numTargets, int chun /* * Creat and open a file through the POSIX interface. */ -void *POSIX_Create(char *testFileName, int flags, void * param) +void *POSIX_Create(char *testFileName, int flags, airori_mod_opt_t * param) { int fd_oflag = O_BINARY; int mode = 0664; @@ -503,7 +503,7 @@ int POSIX_Mknod(char *testFileName) /* * Open a file through the POSIX interface. */ -void *POSIX_Open(char *testFileName, int flags, void * param) +void *POSIX_Open(char *testFileName, int flags, airori_mod_opt_t * param) { int fd_oflag = O_BINARY; int *fd; @@ -549,7 +549,7 @@ void *POSIX_Open(char *testFileName, int flags, void * param) * Write or read access to file using the POSIX interface. */ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, - IOR_offset_t length, void * param) + IOR_offset_t length, airori_mod_opt_t * param) { int xferRetries = 0; long long remaining = (long long)length; @@ -634,14 +634,14 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform fsync(). */ -static void POSIX_Fsync(void *fd, void * param) +static void POSIX_Fsync(void *fd, airori_mod_opt_t * param) { if (fsync(*(int *)fd) != 0) EWARNF("fsync(%d) failed", *(int *)fd); } -static void POSIX_Sync(void * param) +static void POSIX_Sync(airori_mod_opt_t * param) { int ret = system("sync"); if (ret != 0){ @@ -653,7 +653,7 @@ static void POSIX_Sync(void * param) /* * Close a file through the POSIX interface. */ -void POSIX_Close(void *fd, void * param) +void POSIX_Close(void *fd, airori_mod_opt_t * param) { if(ior_param->dryRun) return; @@ -665,7 +665,7 @@ void POSIX_Close(void *fd, void * param) /* * Delete a file through the POSIX interface. */ -void POSIX_Delete(char *testFileName, void * param) +void POSIX_Delete(char *testFileName, airori_mod_opt_t * param) { if(ior_param->dryRun) return; @@ -678,7 +678,7 @@ void POSIX_Delete(char *testFileName, void * param) /* * Use POSIX stat() to return aggregate file size. */ -IOR_offset_t POSIX_GetFileSize(void * test, MPI_Comm testComm, +IOR_offset_t POSIX_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) { if(ior_param->dryRun) diff --git a/src/aiori.c b/src/aiori.c index 592c503..42eb871 100644 --- a/src/aiori.c +++ b/src/aiori.c @@ -152,7 +152,7 @@ void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type) * This function provides a AIORI statfs for POSIX-compliant filesystems. It * uses statvfs is available and falls back on statfs. */ -int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, void * module_options) +int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, airori_mod_opt_t * module_options) { int ret; #if defined(HAVE_STATVFS) @@ -177,22 +177,22 @@ int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, void * m return 0; } -int aiori_posix_mkdir (const char *path, mode_t mode, void * module_options) +int aiori_posix_mkdir (const char *path, mode_t mode, airori_mod_opt_t * module_options) { return mkdir (path, mode); } -int aiori_posix_rmdir (const char *path, void * module_options) +int aiori_posix_rmdir (const char *path, airori_mod_opt_t * module_options) { return rmdir (path); } -int aiori_posix_access (const char *path, int mode, void * module_options) +int aiori_posix_access (const char *path, int mode, airori_mod_opt_t * module_options) { return access (path, mode); } -int aiori_posix_stat (const char *path, struct stat *buf, void * module_options) +int aiori_posix_stat (const char *path, struct stat *buf, airori_mod_opt_t * module_options) { return stat (path, buf); } diff --git a/src/aiori.h b/src/aiori.h index f99c424..dab41c6 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -63,35 +63,40 @@ typedef struct ior_aiori_statfs { uint64_t f_ffree; } ior_aiori_statfs_t; +/* this is a dummy structure to create some type safety */ +typedef struct airori_mod_opt_t{ + void * dummy; +} airori_mod_opt_t; + typedef struct ior_aiori { char *name; char *name_legacy; - void *(*create)(char *, int iorflags, void *); + void *(*create)(char *, int iorflags, airori_mod_opt_t *); int (*mknod)(char *); - void *(*open)(char *, int iorflags, void *); + void *(*open)(char *, int iorflags, airori_mod_opt_t *); /* Allow to set generic transfer options that shall be applied to any subsequent IO call. */ void (*init_xfer_options)(IOR_param_t * params); IOR_offset_t (*xfer)(int, void *, IOR_size_t *, - IOR_offset_t, void *); - void (*close)(void *, void *); - void (*delete)(char *, void *); + IOR_offset_t, airori_mod_opt_t *); + void (*close)(void *, airori_mod_opt_t *); + void (*delete)(char *, airori_mod_opt_t *); char* (*get_version)(void); - void (*fsync)(void *, void *); - IOR_offset_t (*get_file_size)(void * module_options, MPI_Comm, char *); - int (*statfs) (const char *, ior_aiori_statfs_t *, void * module_options); - int (*mkdir) (const char *path, mode_t mode, void * module_options); - int (*rmdir) (const char *path, void * module_options); - int (*access) (const char *path, int mode, void * module_options); - int (*stat) (const char *path, struct stat *buf, void * module_options); - void (*initialize)(void * options); /* called once per program before MPI is started */ - void (*finalize)(void * options); /* 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 */ + void (*fsync)(void *, airori_mod_opt_t *); + IOR_offset_t (*get_file_size)(airori_mod_opt_t * module_options, MPI_Comm, char *); + int (*statfs) (const char *, ior_aiori_statfs_t *, airori_mod_opt_t * module_options); + int (*mkdir) (const char *path, mode_t mode, airori_mod_opt_t * module_options); + int (*rmdir) (const char *path, airori_mod_opt_t * module_options); + int (*access) (const char *path, int mode, airori_mod_opt_t * module_options); + int (*stat) (const char *path, struct stat *buf, airori_mod_opt_t * module_options); + void (*initialize)(airori_mod_opt_t * options); /* called once per program before MPI is started */ + void (*finalize)(airori_mod_opt_t * options); /* called once per program after MPI is shutdown */ + option_help * (*get_options)(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t* init_values); /* initializes the backend options as well and returns the pointer to the option help structure */ + int (*check_params)(airori_mod_opt_t *); /* check if the provided module_optionseters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/ + void (*sync)(airori_mod_opt_t * ); /* synchronize every pending operation for this storage */ bool enable_mdtest; - int (*check_params)(void *); /* check if the provided module_optionseters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/ - void (*sync)(void * ); /* synchronize every pending operation for this storage */ } ior_aiori_t; enum bench_type { @@ -127,26 +132,25 @@ const char *aiori_default (void); /* some generic POSIX-based backend calls */ char * aiori_get_version (void); -int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, void * module_options); -int aiori_posix_mkdir (const char *path, mode_t mode, void * module_options); -int aiori_posix_rmdir (const char *path, void * module_options); -int aiori_posix_access (const char *path, int mode, void * module_options); -int aiori_posix_stat (const char *path, struct stat *buf, void * module_options); +int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, airori_mod_opt_t * module_options); +int aiori_posix_mkdir (const char *path, mode_t mode, airori_mod_opt_t * module_options); +int aiori_posix_rmdir (const char *path, airori_mod_opt_t * module_options); +int aiori_posix_access (const char *path, int mode, airori_mod_opt_t * module_options); +int aiori_posix_stat (const char *path, struct stat *buf, airori_mod_opt_t * module_options); void aiori_posix_init_xfer_options(IOR_param_t * params); -void *POSIX_Create(char *testFileName, int flags, void * module_options); +void *POSIX_Create(char *testFileName, int flags, airori_mod_opt_t * module_options); int POSIX_Mknod(char *testFileName); -void *POSIX_Open(char *testFileName, int flags, void * module_options); -IOR_offset_t POSIX_GetFileSize(void * test, MPI_Comm testComm, char *testFileName); -void POSIX_Delete(char *testFileName, void * module_options); -void POSIX_Close(void *fd, void * module_options); -option_help * POSIX_options(void ** init_backend_options, void * init_values); +void *POSIX_Open(char *testFileName, int flags, airori_mod_opt_t * module_options); +IOR_offset_t POSIX_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, char *testFileName); +void POSIX_Delete(char *testFileName, airori_mod_opt_t * module_options); +void POSIX_Close(void *fd, airori_mod_opt_t * module_options); +option_help * POSIX_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values); /* NOTE: these 3 MPI-IO functions are exported for reuse by HDF5/PNetCDF */ -void MPIIO_Delete(char *testFileName, void * module_options); -IOR_offset_t MPIIO_GetFileSize(void * test, MPI_Comm testComm, - char *testFileName); -int MPIIO_Access(const char *, int, void *); +void MPIIO_Delete(char *testFileName, airori_mod_opt_t * module_options); +IOR_offset_t MPIIO_GetFileSize(airori_mod_opt_t * options, MPI_Comm testComm, char *testFileName); +int MPIIO_Access(const char *, int, airori_mod_opt_t *); #endif /* not _AIORI_H */ diff --git a/src/ior.c b/src/ior.c index 59fc26b..3323b7f 100755 --- a/src/ior.c +++ b/src/ior.c @@ -824,15 +824,15 @@ static char *PrependDir(IOR_param_t * test, char *rootDir) sprintf(dir + i + 1, "%d", (rank + rankOffset) % test->numTasks); /* dir doesn't exist, so create */ - if (backend->access(dir, F_OK, test) != 0) { - if (backend->mkdir(dir, S_IRWXU, test) < 0) { + if (backend->access(dir, F_OK, test->backend_options) != 0) { + if (backend->mkdir(dir, S_IRWXU, test->backend_options) < 0) { ERRF("cannot create directory: %s", dir); } /* check if correct permissions */ - } else if (backend->access(dir, R_OK, test) != 0 || - backend->access(dir, W_OK, test) != 0 || - backend->access(dir, X_OK, test) != 0) { + } else if (backend->access(dir, R_OK, test->backend_options) != 0 || + backend->access(dir, W_OK, test->backend_options) != 0 || + backend->access(dir, X_OK, test->backend_options) != 0) { ERRF("invalid directory permissions: %s", dir); } @@ -919,24 +919,24 @@ static void RemoveFile(char *testFileName, int filePerProc, IOR_param_t * test) rankOffset = 0; GetTestFileName(testFileName, test); } - if (backend->access(testFileName, F_OK, test) == 0) { + if (backend->access(testFileName, F_OK, test->backend_options) == 0) { if (verbose >= VERBOSE_3) { fprintf(out_logfile, "task %d removing %s\n", rank, testFileName); } - backend->delete(testFileName, test); + backend->delete(testFileName, test->backend_options); } if (test->reorderTasksRandom == TRUE) { rankOffset = tmpRankOffset; GetTestFileName(testFileName, test); } } else { - if ((rank == 0) && (backend->access(testFileName, F_OK, test) == 0)) { + if ((rank == 0) && (backend->access(testFileName, F_OK, test->backend_options) == 0)) { if (verbose >= VERBOSE_3) { fprintf(out_logfile, "task %d removing %s\n", rank, testFileName); } - backend->delete(testFileName, test); + backend->delete(testFileName, test->backend_options); } } } @@ -1359,14 +1359,14 @@ static void TestIoSys(IOR_test_t *test) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); timer[4] = GetTimeStamp(); - backend->close(fd, params); + backend->close(fd, params->backend_options); timer[5] = GetTimeStamp(); MPI_CHECK(MPI_Barrier(testComm), "barrier error"); /* get the size of the file just written */ results[rep].write.aggFileSizeFromStat = - backend->get_file_size(params, testComm, testFileName); + backend->get_file_size(params->backend_options, testComm, testFileName); /* check if stat() of file doesn't equal expected file size, use actual amount of byte moved */ @@ -1412,9 +1412,9 @@ static void TestIoSys(IOR_test_t *test) GetTestFileName(testFileName, params); params->open = WRITECHECK; - fd = backend->open(testFileName, IOR_RDONLY, params); + fd = backend->open(testFileName, IOR_RDONLY, params->backend_options); dataMoved = WriteOrRead(params, &results[rep], fd, WRITECHECK, &ioBuffers); - backend->close(fd, params); + backend->close(fd, params->backend_options); rankOffset = 0; } /* @@ -1484,7 +1484,7 @@ static void TestIoSys(IOR_test_t *test) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); params->open = READ; timer[0] = GetTimeStamp(); - fd = backend->open(testFileName, IOR_RDONLY, params); + fd = backend->open(testFileName, IOR_RDONLY, params->backend_options); timer[1] = GetTimeStamp(); if (params->intraTestBarriers) MPI_CHECK(MPI_Barrier(testComm), @@ -1501,12 +1501,12 @@ static void TestIoSys(IOR_test_t *test) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); timer[4] = GetTimeStamp(); - backend->close(fd, params); + backend->close(fd, params->backend_options); timer[5] = GetTimeStamp(); /* get the size of the file just read */ results[rep].read.aggFileSizeFromStat = - backend->get_file_size(params, testComm, + backend->get_file_size(params->backend_options, testComm, testFileName); /* check if stat() of file doesn't equal expected file size, @@ -1809,8 +1809,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset nanosleep( & wait, NULL); } } else if (access == READ) { - amtXferred = - backend->xfer(access, fd, buffer, transfer, test); + amtXferred = backend->xfer(access, fd, buffer, transfer, test->backend_options); if (amtXferred != transfer) ERR("cannot read from file"); if (test->interIODelay > 0){ @@ -1824,7 +1823,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset FillBuffer(readCheckBuffer, test, test->offset, pretendRank); } - amtXferred = backend->xfer(access, fd, checkBuffer, transfer, test); + amtXferred = backend->xfer(access, fd, checkBuffer, transfer, test->backend_options); if (amtXferred != transfer) ERR("cannot read from file write check"); (*transferCount)++; @@ -1834,7 +1833,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset } else if (access == READCHECK) { memset(checkBuffer, 'a', transfer); - amtXferred = backend->xfer(access, fd, checkBuffer, transfer, test); + amtXferred = backend->xfer(access, fd, checkBuffer, transfer, test->backend_options); if (amtXferred != transfer){ ERR("cannot read from file"); } @@ -1931,7 +1930,7 @@ static IOR_offset_t WriteOrRead(IOR_param_t *test, IOR_results_t *results, free(offsetArray); if (access == WRITE && test->fsync == TRUE) { - backend->fsync(fd, test); /*fsync after all accesses */ + backend->fsync(fd, test->backend_options); /*fsync after all accesses */ } return (dataMoved); } diff --git a/src/ior.h b/src/ior.h index f09d617..d208507 100755 --- a/src/ior.h +++ b/src/ior.h @@ -94,6 +94,7 @@ typedef struct char * options; /* options string */ // intermediate options int collective; /* collective I/O */ + MPI_Comm testComm; /* MPI communicator */ int dryRun; /* do not perform any I/Os just run evtl. inputs print dummy output */ int numTasks; /* number of tasks for test */ int numNodes; /* number of nodes for test */ @@ -155,11 +156,6 @@ typedef struct int fsyncPerWrite; /* fsync() after each write */ int fsync; /* fsync() after write */ - /* MPI variables */ - MPI_Comm testComm; /* MPI communicator */ - MPI_Datatype transferType; /* datatype for transfer */ - MPI_Datatype fileType; /* filetype for file view */ - /* HDFS variables */ char * hdfs_user; /* copied from ENV, for now */ const char* hdfs_name_node; diff --git a/src/mdtest.c b/src/mdtest.c index bdd70c9..b81b143 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -2143,8 +2143,8 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * } /* if directory does not exist, create it */ - if ((rank < path_count) && backend->access(testdirpath, F_OK, ¶m) != 0) { - if (backend->mkdir(testdirpath, DIRMODE, ¶m) != 0) { + if ((rank < path_count) && backend->access(testdirpath, F_OK, backend_options) != 0) { + if (backend->mkdir(testdirpath, DIRMODE, backend_options) != 0) { FAIL("Unable to create test directory path %s", testdirpath); } } diff --git a/src/option.h b/src/option.h index 624da51..9c2dffd 100644 --- a/src/option.h +++ b/src/option.h @@ -23,10 +23,12 @@ typedef struct{ void * variable; } option_help; +typedef struct airori_mod_opt_t airori_mod_opt_t; + typedef struct{ char * prefix; // may be NULL to include it in the standard name option_help * options; - void * defaults; // these default values are taken from the command line + airori_mod_opt_t * defaults; // these default values are taken from the command line } option_module; typedef struct{