Clean up lustre striping support.

Error out immediately if a lustre option was specified,
but no lustre support was compiled in.

Set a flag when any lustre string options are set, to
make the code cleaner.
master
Christopher J. Morrone 2011-11-09 14:30:21 -08:00
parent 3b250633cc
commit 877fcd305b
4 changed files with 22 additions and 18 deletions

View File

@ -100,23 +100,8 @@ IOR_Create_POSIX(char * testFileName,
fd_oflag |= O_DIRECT;
}
#ifndef HAVE_LUSTRE_LUSTRE_USER_H
/* If the lustre striping parameters are not the defaults */
if (param->lustre_stripe_count != 0
|| param->lustre_stripe_size != 0
|| param->lustre_start_ost != -1
|| param->lustre_ignore_locks) {
ERR("This IOR was not compiled with Lustre support!");
}
fd_oflag |= O_CREAT | O_RDWR;
*fd = open64(testFileName, fd_oflag, 0664);
if (*fd < 0) ERR("cannot open file");
#else /* HAVE_LUSTRE_LUSTRE_USER_H */
/* If the lustre striping parameters are not the defaults */
if (param->lustre_stripe_count != 0
|| param->lustre_stripe_size != 0
|| param->lustre_start_ost != -1) {
#ifdef HAVE_LUSTRE_LUSTRE_USER_H
if (param->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 */
@ -154,9 +139,11 @@ IOR_Create_POSIX(char * testFileName,
MPI_CHECK(MPI_Barrier(testComm), "barrier error");
}
} else {
#endif /* HAVE_LUSTRE_LUSTRE_USER_H */
fd_oflag |= O_CREAT | O_RDWR;
*fd = open64(testFileName, fd_oflag, 0664);
if (*fd < 0) ERR("cannot open file");
#ifdef HAVE_LUSTRE_LUSTRE_USER_H
}
if (param->lustre_ignore_locks) {
@ -164,7 +151,7 @@ IOR_Create_POSIX(char * testFileName,
if (ioctl(*fd, LL_IOC_SETFLAGS, &lustre_ioctl_flags) == -1)
ERR("cannot set ioctl");
}
#endif /* not HAVE_LUSTRE_LUSTRE_USER_H */
#endif /* HAVE_LUSTRE_LUSTRE_USER_H */
return((void *)fd);
} /* IOR_Create_POSIX() */

View File

@ -147,6 +147,7 @@ typedef struct
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;
#if USE_UNDOC_OPT

View File

@ -113,6 +113,7 @@ IOR_param_t defaultParameters = {
0, /* lustre_stripe_count */
0, /* lustre_stripe_size */
-1, /* lustre_start_ost */
0, /* lustre_set_striping */
0, /* lustre_ignore_locks */
#if USE_UNDOC_OPT

View File

@ -160,12 +160,27 @@ void DecodeDirective(char *line, IOR_param_t *test)
} else if (strcasecmp(option, "randomoffset") == 0) {
test->randomOffset = atoi(value);
} else if (strcasecmp(option, "lustrestripecount") == 0) {
#ifndef HAVE_LUSTRE_LUSTRE_USER_H
ERR("ior was not compiled with Lustre support");
#endif
test->lustre_stripe_count = atoi(value);
test->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
test->lustre_stripe_size = StringToBytes(value);
test->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
test->lustre_start_ost = atoi(value);
test->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
test->lustre_ignore_locks = atoi(value);
#if USE_UNDOC_OPT
} else if (strcasecmp(option, "corruptFile") == 0) {