Moved Lustre/GPFS/BeeGFS options into POSIX backend. Needs testing. Additional minor fixes.

master
Julian M. Kunkel 2020-05-30 20:09:37 +01:00
parent 930ccdc68d
commit e91b79cea0
10 changed files with 90 additions and 113 deletions

View File

@ -86,6 +86,7 @@ static IOR_param_t * ior_param = NULL;
static void MMAP_init_xfer_options(IOR_param_t * params){
ior_param = params;
aiori_posix_init_xfer_options(params);
}
static int MMAP_check_params(void * options){

View File

@ -72,13 +72,28 @@ 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 void POSIX_init_xfer_options(IOR_param_t * params);
static int POSIX_check_params(void * options);
/************************** O P T I O N S *****************************/
typedef struct{
/* in case of a change, please update depending MMAP module too */
int direct_io;
/* Lustre variables */
int lustre_set_striping; /* flag that we need to set lustre striping */
int lustre_stripe_count;
int lustre_stripe_size;
int lustre_start_ost;
int lustre_ignore_locks;
/* gpfs variables */
int gpfs_hint_access; /* use gpfs "access range" hint */
int gpfs_release_token; /* immediately release GPFS tokens after
creating or opening a file */
/* beegfs variables */
int beegfs_numTargets; /* number storage targets to use */
int beegfs_chunkSize; /* srtipe pattern for new files */
} posix_options_t;
@ -88,13 +103,32 @@ option_help * POSIX_options(void ** init_backend_options, void * init_values){
if (init_values != NULL){
memcpy(o, init_values, sizeof(posix_options_t));
}else{
memset(o, 0, sizeof(posix_options_t));
o->direct_io = 0;
o->lustre_start_ost = -1;
o->beegfs_numTargets = -1;
o->beegfs_chunkSize = -1;
}
*init_backend_options = o;
option_help h [] = {
{0, "posix.odirect", "Direct I/O Mode", OPTION_FLAG, 'd', & o->direct_io},
#ifdef HAVE_BEEGFS_BEEGFS_H
{0, "posix.beegfs.NumTargets", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->beegfs_numTargets},
{0, "posix.beegfs.ChunkSize", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->beegfs_chunkSize},
#endif
#ifdef HAVE_GPFS_FCNTL_H
{0, "posix.gpfs.hintaccess", "", OPTION_FLAG, 'd', & o->gpfs_hint_access},
{0, "posix.gpfs.releasetoken", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->gpfs_release_token},
#endif
#ifdef HAVE_LUSTRE_LUSTRE_USER_H
{0, "posix.lustre.stripecount", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->lustre_stripe_count},
{0, "posix.lustre.stripesize", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->lustre_stripe_size},
{0, "posix.lustre.startost", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->lustre_start_ost},
{0, "posix.lustre.ignorelocks", "", OPTION_FLAG, 'd', & o->lustre_ignore_locks},
#endif
LAST_OPTION
};
option_help * help = malloc(sizeof(h));
@ -115,7 +149,7 @@ ior_aiori_t posix_aiori = {
.xfer = POSIX_Xfer,
.close = POSIX_Close,
.delete = POSIX_Delete,
.init_xfer_options = POSIX_init_xfer_options,
.init_xfer_options = aiori_posix_init_xfer_options,
.get_version = aiori_get_version,
.fsync = POSIX_Fsync,
.get_file_size = POSIX_GetFileSize,
@ -126,17 +160,29 @@ ior_aiori_t posix_aiori = {
.stat = aiori_posix_stat,
.get_options = POSIX_options,
.enable_mdtest = true,
.sync = POSIX_Sync
.sync = POSIX_Sync,
.check_params = POSIX_check_params
};
/***************************** F U N C T I O N S ******************************/
static IOR_param_t * ior_param = NULL;
static void POSIX_init_xfer_options(IOR_param_t * params){
void aiori_posix_init_xfer_options(IOR_param_t * params){
ior_param = params;
}
static int POSIX_check_params(void * 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");
if (o->beegfs_chunkSize != -1 && (!ISPOWEROFTWO(o->beegfs_chunkSize) || o->beegfs_chunkSize < (1<<16)))
ERR("beegfsChunkSize must be a power of two and >64k");
if(o->lustre_stripe_count != -1 || o->lustre_stripe_size != 0)
o->lustre_set_striping = 1;
return 0;
}
#ifdef HAVE_GPFS_FCNTL_H
void gpfs_free_all_locks(int fd)
{
@ -159,7 +205,7 @@ void gpfs_free_all_locks(int fd)
EWARNF("gpfs_fcntl(%d, ...) release all locks hint failed.", fd);
}
}
void gpfs_access_start(int fd, IOR_offset_t length, void *param, int access)
void gpfs_access_start(int fd, IOR_offset_t length, int access)
{
int rc;
struct {
@ -173,7 +219,7 @@ void gpfs_access_start(int fd, IOR_offset_t length, void *param, int access)
take_locks.access.structLen = sizeof(take_locks.access);
take_locks.access.structType = GPFS_ACCESS_RANGE;
take_locks.access.start = param->offset;
take_locks.access.start = ior_param->offset;
take_locks.access.length = length;
take_locks.access.isWrite = (access == WRITE);
@ -183,7 +229,7 @@ void gpfs_access_start(int fd, IOR_offset_t length, void *param, int access)
}
}
void gpfs_access_end(int fd, IOR_offset_t length, void *param, int access)
void gpfs_access_end(int fd, IOR_offset_t length, int access)
{
int rc;
struct {
@ -198,7 +244,7 @@ void gpfs_access_end(int fd, IOR_offset_t length, void *param, int access)
free_locks.free.structLen = sizeof(free_locks.free);
free_locks.free.structType = GPFS_FREE_RANGE;
free_locks.free.start = param->offset;
free_locks.free.start = ior_param->offset;
free_locks.free.length = length;
rc = gpfs_fcntl(fd, &free_locks);
@ -349,12 +395,11 @@ void *POSIX_Create(char *testFileName, int flags, void * param)
#ifndef FASYNC
#define FASYNC 00020000 /* fcntl, for BSD compatibility */
#endif
if (param->lustre_set_striping) {
if (o->lustre_set_striping) {
/* In the single-shared-file case, task 0 has to creat the
file with the Lustre striping options before any other processes
open the file */
if (!param->filePerProc && rank != 0) {
if (!ior_param->filePerProc && rank != 0) {
MPI_CHECK(MPI_Barrier(testComm), "barrier error");
fd_oflag |= O_RDWR;
*fd = open64(testFileName, fd_oflag, mode);
@ -366,9 +411,9 @@ void *POSIX_Create(char *testFileName, int flags, void * param)
/* Setup Lustre IOCTL striping pattern structure */
opts.lmm_magic = LOV_USER_MAGIC;
opts.lmm_stripe_size = param->lustre_stripe_size;
opts.lmm_stripe_offset = param->lustre_start_ost;
opts.lmm_stripe_count = param->lustre_stripe_count;
opts.lmm_stripe_size = o->lustre_stripe_size;
opts.lmm_stripe_offset = o->lustre_start_ost;
opts.lmm_stripe_count = o->lustre_stripe_count;
/* File needs to be opened O_EXCL because we cannot set
* Lustre striping information on a pre-existing file.*/
@ -391,7 +436,7 @@ void *POSIX_Create(char *testFileName, int flags, void * param)
MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1),
"MPI_Abort() error");
}
if (!param->filePerProc)
if (!ior_param->filePerProc)
MPI_CHECK(MPI_Barrier(testComm),
"barrier error");
}
@ -401,12 +446,12 @@ void *POSIX_Create(char *testFileName, int flags, void * param)
fd_oflag |= O_CREAT | O_RDWR;
#ifdef HAVE_BEEGFS_BEEGFS_H
if (beegfs_isOptionSet(param->beegfs_chunkSize)
|| beegfs_isOptionSet(param->beegfs_numTargets)) {
if (beegfs_isOptionSet(o->beegfs_chunkSize)
|| beegfs_isOptionSet(o->beegfs_numTargets)) {
bool result = beegfs_createFilePath(testFileName,
mode,
param->beegfs_numTargets,
param->beegfs_chunkSize);
o->beegfs_numTargets,
o->beegfs_chunkSize);
if (result) {
fd_oflag &= ~O_CREAT;
} else {
@ -423,7 +468,7 @@ void *POSIX_Create(char *testFileName, int flags, void * param)
#ifdef HAVE_LUSTRE_LUSTRE_USER_H
}
if (param->lustre_ignore_locks) {
if (o->lustre_ignore_locks) {
int lustre_ioctl_flags = LL_FILE_IGNORE_LOCK;
if (ioctl(*fd, LL_IOC_SETFLAGS, &lustre_ioctl_flags) == -1)
ERRF("ioctl(%d, LL_IOC_SETFLAGS, ...) failed", *fd);
@ -434,7 +479,7 @@ void *POSIX_Create(char *testFileName, int flags, void * param)
/* in the single shared file case, immediately release all locks, with
* the intent that we can avoid some byte range lock revocation:
* everyone will be writing/reading from individual regions */
if (param->gpfs_release_token ) {
if (o->gpfs_release_token ) {
gpfs_free_all_locks(*fd);
}
#endif
@ -481,7 +526,7 @@ void *POSIX_Open(char *testFileName, int flags, void * param)
ERRF("open64(\"%s\", %d) failed", testFileName, fd_oflag);
#ifdef HAVE_LUSTRE_LUSTRE_USER_H
if (param->lustre_ignore_locks) {
if (o->lustre_ignore_locks) {
int lustre_ioctl_flags = LL_FILE_IGNORE_LOCK;
if (verbose >= VERBOSE_1) {
fprintf(stdout,
@ -493,7 +538,7 @@ void *POSIX_Open(char *testFileName, int flags, void * param)
#endif /* HAVE_LUSTRE_LUSTRE_USER_H */
#ifdef HAVE_GPFS_FCNTL_H
if(param->gpfs_release_token) {
if(o->gpfs_release_token) {
gpfs_free_all_locks(*fd);
}
#endif
@ -511,6 +556,7 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer,
char *ptr = (char *)buffer;
long long rc;
int fd;
posix_options_t * o = (posix_options_t*) param;
if(ior_param->dryRun)
return length;
@ -518,8 +564,8 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer,
fd = *(int *)file;
#ifdef HAVE_GPFS_FCNTL_H
if (param->gpfs_hint_access) {
gpfs_access_start(fd, length, param, access);
if (o->gpfs_hint_access) {
gpfs_access_start(fd, length, access);
}
#endif
@ -578,7 +624,7 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer,
xferRetries++;
}
#ifdef HAVE_GPFS_FCNTL_H
if (param->gpfs_hint_access) {
if (o->gpfs_hint_access) {
gpfs_access_end(fd, length, param, access);
}
#endif

View File

@ -132,6 +132,7 @@ 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);
void aiori_posix_init_xfer_options(IOR_param_t * params);
void *POSIX_Create(char *testFileName, int flags, void * module_options);
int POSIX_Mknod(char *testFileName);

View File

@ -444,14 +444,6 @@ void ShowSetup(IOR_param_t *params)
if(params->dryRun){
PrintKeyValInt("dryRun", params->dryRun);
}
#ifdef HAVE_LUSTRE_LUSTRE_USER_H
if (params->lustre_set_striping) {
PrintKeyVal("Lustre stripe size", ((params->lustre_stripe_size == 0) ? "Use default" :
HumanReadable(params->lustre_stripe_size, BASE_TWO)));
PrintKeyValInt("Lustre stripe count", params->lustre_stripe_count);
}
#endif /* HAVE_LUSTRE_LUSTRE_USER_H */
if (params->deadlineForStonewalling > 0) {
PrintKeyValInt("stonewallingTime", params->deadlineForStonewalling);
PrintKeyValInt("stoneWallingWearOut", params->stoneWallingWearOut );

View File

@ -214,7 +214,6 @@ void init_IOR_Param_t(IOR_param_t * p)
p->randomSeed = -1;
p->incompressibleSeed = 573;
p->testComm = mpi_comm_world;
p->lustre_start_ost = -1;
hdfs_user = getenv("USER");
if (!hdfs_user)
@ -228,9 +227,6 @@ void init_IOR_Param_t(IOR_param_t * p)
p->URI = NULL;
p->part_number = 0;
p->beegfs_numTargets = -1;
p->beegfs_chunkSize = -1;
}
static void
@ -1646,15 +1642,13 @@ static void ValidateTests(IOR_param_t * test)
ERR("random offset not available with NCMPI");
if ((strcasecmp(test->api, "NCMPI") == 0) && test->filePerProc)
ERR("file-per-proc not available in current NCMPI");
if (test->useExistingTestFile && test->lustre_set_striping)
ERR("Lustre stripe options are incompatible with useExistingTestFile");
if(test->backend->init_xfer_options){
test->backend->init_xfer_options(test);
}
/* allow the backend to validate the options */
if(test->backend->check_params){
if(test->backend->init_xfer_options){
test->backend->init_xfer_options(test);
}
int check = test->backend->check_params(test);
int check = test->backend->check_params(test->backend_options);
if (check){
ERR("The backend returned that the test parameters are invalid.");
}

View File

@ -36,8 +36,9 @@
typedef void *rados_ioctx_t;
#endif
#include "option.h"
#include "iordef.h"
#define ISPOWEROFTWO(x) ((x != 0) && !(x & (x - 1)))
/******************** DATA Packet Type ***************************************/
/* Holds the types of data packets: generic, offset, timestamp, incompressible */
@ -178,21 +179,6 @@ typedef struct
/* NCMPI variables */
int var_id; /* variable id handle for data set */
/* Lustre variables */
int lustre_stripe_count;
int lustre_stripe_size;
int lustre_start_ost;
int lustre_set_striping; /* flag that we need to set lustre striping */
int lustre_ignore_locks;
/* gpfs variables */
int gpfs_hint_access; /* use gpfs "access range" hint */
int gpfs_release_token; /* immediately release GPFS tokens after
creating or opening a file */
/* beegfs variables */
int beegfs_numTargets; /* number storage targets to use */
int beegfs_chunkSize; /* srtipe pattern for new files */
int id; /* test's unique ID */
int intraTestBarriers; /* barriers between open/op and op/close */
} IOR_param_t;

View File

@ -181,13 +181,13 @@ typedef long long int IOR_size_t;
/* display error message and terminate execution */
#define ERR(MSG) do { \
#define ERR_ERRNO(MSG) do { \
ERRF("%s", MSG); \
} while (0)
/* display a simple error message (i.e. errno is not set) and terminate execution */
#define ERR_SIMPLE(MSG) do { \
#define ERR(MSG) do { \
fprintf(stdout, "ior ERROR: %s, (%s:%d)\n", \
MSG, __FILE__, __LINE__); \
fflush(stdout); \

View File

@ -1966,6 +1966,12 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE *
if (backend->initialize){
backend->initialize(backend_options);
}
if(backend->init_xfer_options){
backend->init_xfer_options(& param);
}
if(backend->check_params){
backend->check_params(backend_options);
}
pid = getpid();
uid = getuid();

View File

@ -32,8 +32,6 @@
#include "option.h"
#include "aiori.h"
#define ISPOWEROFTWO(x) ((x != 0) && !(x & (x - 1)))
IOR_param_t initialTestParams;
option_help * createGlobalOptions(IOR_param_t * params);
@ -205,53 +203,6 @@ void DecodeDirective(char *line, IOR_param_t *params, options_all_t * module_opt
} else if (strcasecmp(option, "memoryPerNode") == 0) {
params->memoryPerNode = NodeMemoryStringToBytes(value);
params->memoryPerTask = 0;
} else if (strcasecmp(option, "lustrestripecount") == 0) {
#ifndef HAVE_LUSTRE_LUSTRE_USER_H
ERR("ior was not compiled with Lustre support");
#endif
params->lustre_stripe_count = atoi(value);
params->lustre_set_striping = 1;
} else if (strcasecmp(option, "lustrestripesize") == 0) {
#ifndef HAVE_LUSTRE_LUSTRE_USER_H
ERR("ior was not compiled with Lustre support");
#endif
params->lustre_stripe_size = string_to_bytes(value);
params->lustre_set_striping = 1;
} else if (strcasecmp(option, "lustrestartost") == 0) {
#ifndef HAVE_LUSTRE_LUSTRE_USER_H
ERR("ior was not compiled with Lustre support");
#endif
params->lustre_start_ost = atoi(value);
params->lustre_set_striping = 1;
} else if (strcasecmp(option, "lustreignorelocks") == 0) {
#ifndef HAVE_LUSTRE_LUSTRE_USER_H
ERR("ior was not compiled with Lustre support");
#endif
params->lustre_ignore_locks = atoi(value);
} else if (strcasecmp(option, "gpfshintaccess") == 0) {
#ifndef HAVE_GPFS_FCNTL_H
ERR("ior was not compiled with GPFS hint support");
#endif
params->gpfs_hint_access = atoi(value);
} else if (strcasecmp(option, "gpfsreleasetoken") == 0) {
#ifndef HAVE_GPFS_FCNTL_H
ERR("ior was not compiled with GPFS hint support");
#endif
params->gpfs_release_token = atoi(value);
} else if (strcasecmp(option, "beegfsNumTargets") == 0) {
#ifndef HAVE_BEEGFS_BEEGFS_H
ERR("ior was not compiled with BeeGFS support");
#endif
params->beegfs_numTargets = atoi(value);
if (params->beegfs_numTargets < 1)
ERR("beegfsNumTargets must be >= 1");
} else if (strcasecmp(option, "beegfsChunkSize") == 0) {
#ifndef HAVE_BEEGFS_BEEGFS_H
ERR("ior was not compiled with BeeGFS support");
#endif
params->beegfs_chunkSize = string_to_bytes(value);
if (!ISPOWEROFTWO(params->beegfs_chunkSize) || params->beegfs_chunkSize < (1<<16))
ERR("beegfsChunkSize must be a power of two and >64k");
} else if (strcasecmp(option, "summaryalways") == 0) {
params->summary_every_test = atoi(value);
} else {

View File

@ -146,7 +146,7 @@ void updateParsedOptions(IOR_param_t * options, options_all_t * global_options){
}
const ior_aiori_t * backend = aiori_select(options->api);
if (backend == NULL)
ERR_SIMPLE("unrecognized I/O API");
ERR("Unrecognized I/O API");
options->backend = backend;
/* copy the actual module options into the test */