Merge pull request #160 from hpc/fix-ime-157

Moving IME ODirect option into IME. #157
master
Julian Kunkel 2019-05-28 08:41:26 +01:00 committed by GitHub
commit cdaca2c591
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 32 additions and 2 deletions

View File

@ -54,6 +54,33 @@ static int IME_Stat(const char *, struct stat *, IOR_param_t *);
static void IME_Initialize();
static void IME_Finalize();
/************************** O P T I O N S *****************************/
typedef struct{
int direct_io;
} ime_options_t;
option_help * IME_options(void ** init_backend_options, void * init_values){
ime_options_t * o = malloc(sizeof(ime_options_t));
if (init_values != NULL){
memcpy(o, init_values, sizeof(ime_options_t));
}else{
o->direct_io = 0;
}
*init_backend_options = o;
option_help h [] = {
{0, "ime.odirect", "Direct I/O Mode", OPTION_FLAG, 'd', & o->direct_io},
LAST_OPTION
};
option_help * help = malloc(sizeof(h));
memcpy(help, h, sizeof(h));
return help;
}
/************************** D E C L A R A T I O N S ***************************/
extern int rank;
@ -79,6 +106,7 @@ ior_aiori_t ime_aiori = {
.stat = IME_Stat,
.initialize = IME_Initialize,
.finalize = IME_Finalize,
.get_options = IME_options,
.enable_mdtest = true,
};
@ -130,8 +158,10 @@ static void *IME_Open(char *testFileName, IOR_param_t *param)
if (fd == NULL)
ERR("Unable to malloc file descriptor");
if (param->useO_DIRECT)
set_o_direct_flag(&fd_oflag);
ime_options_t * o = (ime_options_t*) param->backend_options;
if (o->direct_io == TRUE){
set_o_direct_flag(&fd_oflag);
}
if (param->openFlags & IOR_RDONLY)
fd_oflag |= O_RDONLY;