AIORI POSIX use internal debug macros, include errno in msg.

master
Julian M. Kunkel 2021-01-21 11:06:13 +00:00
parent d5f5cf974d
commit 852ee3e40e
2 changed files with 27 additions and 25 deletions

View File

@ -378,9 +378,10 @@ aiori_fd_t *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param)
MPI_CHECK(MPI_Barrier(testComm), "barrier error"); MPI_CHECK(MPI_Barrier(testComm), "barrier error");
fd_oflag |= O_RDWR; fd_oflag |= O_RDWR;
*fd = open64(testFileName, fd_oflag, mode); *fd = open64(testFileName, fd_oflag, mode);
if (*fd < 0) if (*fd < 0){
ERRF("open64(\"%s\", %d, %#o) failed", ERRF("open64(\"%s\", %d, %#o) failed. Error: %s",
testFileName, fd_oflag, mode); testFileName, fd_oflag, mode, strerror(errno));
}
} else { } else {
struct lov_user_md opts = { 0 }; struct lov_user_md opts = { 0 };
@ -396,19 +397,14 @@ aiori_fd_t *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param)
fd_oflag |= O_CREAT | O_EXCL | O_RDWR | O_LOV_DELAY_CREATE; fd_oflag |= O_CREAT | O_EXCL | O_RDWR | O_LOV_DELAY_CREATE;
*fd = open64(testFileName, fd_oflag, mode); *fd = open64(testFileName, fd_oflag, mode);
if (*fd < 0) { if (*fd < 0) {
fprintf(stdout, "\nUnable to open '%s': %s\n", ERRF("Unable to open '%s': %s\n",
testFileName, strerror(errno)); testFileName, strerror(errno));
MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1),
"MPI_Abort() error");
} else if (ioctl(*fd, LL_IOC_LOV_SETSTRIPE, &opts)) { } else if (ioctl(*fd, LL_IOC_LOV_SETSTRIPE, &opts)) {
char *errmsg = "stripe already set"; char *errmsg = "stripe already set";
if (errno != EEXIST && errno != EALREADY) if (errno != EEXIST && errno != EALREADY)
errmsg = strerror(errno); errmsg = strerror(errno);
fprintf(stdout, ERRF("Error on ioctl for '%s' (%d): %s\n",
"\nError on ioctl for '%s' (%d): %s\n",
testFileName, *fd, errmsg); testFileName, *fd, errmsg);
MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1),
"MPI_Abort() error");
} }
if (!hints->filePerProc) if (!hints->filePerProc)
MPI_CHECK(MPI_Barrier(testComm), MPI_CHECK(MPI_Barrier(testComm),
@ -435,9 +431,10 @@ aiori_fd_t *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param)
#endif /* HAVE_BEEGFS_BEEGFS_H */ #endif /* HAVE_BEEGFS_BEEGFS_H */
*fd = open64(testFileName, fd_oflag, mode); *fd = open64(testFileName, fd_oflag, mode);
if (*fd < 0) if (*fd < 0){
ERRF("open64(\"%s\", %d, %#o) failed", ERRF("open64(\"%s\", %d, %#o) failed. Error: %s",
testFileName, fd_oflag, mode); testFileName, fd_oflag, mode, strerror(errno));
}
#ifdef HAVE_LUSTRE_USER #ifdef HAVE_LUSTRE_USER
} }
@ -503,8 +500,7 @@ aiori_fd_t *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * param)
if (o->lustre_ignore_locks) { if (o->lustre_ignore_locks) {
int lustre_ioctl_flags = LL_FILE_IGNORE_LOCK; int lustre_ioctl_flags = LL_FILE_IGNORE_LOCK;
if (verbose >= VERBOSE_1) { if (verbose >= VERBOSE_1) {
fprintf(stdout, EINFO("** Disabling lustre range locking **\n");
"** Disabling lustre range locking **\n");
} }
if (ioctl(*fd, LL_IOC_SETFLAGS, &lustre_ioctl_flags) == -1) if (ioctl(*fd, LL_IOC_SETFLAGS, &lustre_ioctl_flags) == -1)
ERRF("ioctl(%d, LL_IOC_SETFLAGS, ...) failed", *fd); ERRF("ioctl(%d, LL_IOC_SETFLAGS, ...) failed", *fd);
@ -552,8 +548,7 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer
/* write/read file */ /* write/read file */
if (access == WRITE) { /* WRITE */ if (access == WRITE) { /* WRITE */
if (verbose >= VERBOSE_4) { if (verbose >= VERBOSE_4) {
fprintf(stdout, EINFO("task %d writing to offset %lld\n",
"task %d writing to offset %lld\n",
rank, rank,
offset + length - remaining); offset + length - remaining);
} }
@ -566,8 +561,7 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer
} }
} else { /* READ or CHECK */ } else { /* READ or CHECK */
if (verbose >= VERBOSE_4) { if (verbose >= VERBOSE_4) {
fprintf(stdout, EINFO("task %d reading from offset %lld\n",
"task %d reading from offset %lld\n",
rank, rank,
offset + length - remaining); offset + length - remaining);
} }
@ -580,16 +574,12 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer
fd, (void*)ptr, remaining); fd, (void*)ptr, remaining);
} }
if (rc < remaining) { if (rc < remaining) {
fprintf(stdout, EWARNF("task %d, partial %s, %lld of %lld bytes at offset %lld\n",
"WARNING: Task %d, partial %s, %lld of %lld bytes at offset %lld\n",
rank, rank,
access == WRITE ? "write()" : "read()", access == WRITE ? "write()" : "read()",
rc, remaining, rc, remaining,
offset + length - remaining); offset + length - remaining);
if (hints->singleXferAttempt == TRUE) if (xferRetries > MAX_RETRY || hints->singleXferAttempt)
MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1),
"barrier error");
if (xferRetries > MAX_RETRY)
ERR("too many retries -- aborting"); ERR("too many retries -- aborting");
} }
assert(rc >= 0); assert(rc >= 0);

View File

@ -61,6 +61,18 @@ extern int aiori_warning_as_errors;
} while (0) } while (0)
/* warning with format string and errno printed */
#define EINFO(FORMAT, ...) do { \
if (verbose > VERBOSE_2) { \
fprintf(out_logfile, "INFO: " FORMAT ", (%s:%d).\n", \
__VA_ARGS__, __FILE__, __LINE__); \
} else { \
fprintf(out_logfile, "INFO: " FORMAT "\n", \
__VA_ARGS__); \
} \
fflush(out_logfile); \
} while (0)
/* display error message with format string and terminate execution */ /* display error message with format string and terminate execution */
#define ERRF(FORMAT, ...) do { \ #define ERRF(FORMAT, ...) do { \
fprintf(out_logfile, "ERROR: " FORMAT ", (%s:%d)\n", \ fprintf(out_logfile, "ERROR: " FORMAT ", (%s:%d)\n", \