Skip to content

Commit

Permalink
Clean up lustre striping support.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
morrone committed Nov 9, 2011
1 parent 3b25063 commit 877fcd3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
23 changes: 5 additions & 18 deletions src/aiori-POSIX.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -154,17 +139,19 @@ 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) {
int lustre_ioctl_flags = LL_FILE_IGNORE_LOCK;
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() */
Expand Down
1 change: 1 addition & 0 deletions src/aiori.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions src/parse_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 877fcd3

Please sign in to comment.