Skip to content

Commit ac34c0e

Browse files
committed
Merge pull request #1287 from edgargabriel/posix-fbtl-update
use the actual preadv and pwritev functions if available. That's what…
2 parents faeca56 + 0a1b735 commit ac34c0e

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

ompi/mca/fbtl/posix/configure.m4

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ AC_DEFUN([MCA_ompi_fbtl_posix_CONFIG],[
3232
[aio_write], [rt],
3333
[fbtl_posix_happy="yes"])])
3434

35+
AC_CHECK_FUNCS([pwritev],[],[])
36+
AC_CHECK_FUNCS([preadv],[],[])
37+
3538
AS_IF([test "$fbtl_posix_happy" = "yes"],
3639
[$1],
3740
[$2])

ompi/mca/fbtl/posix/fbtl_posix_preadv.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ ssize_t mca_fbtl_posix_preadv (mca_io_ompio_file_t *fh )
8080
}
8181
}
8282

83+
#if defined(HAVE_PREADV)
84+
ret_code = preadv (fh->fd, iov, iov_count, iov_offset);
85+
if ( 0 < ret_code ) {
86+
bytes_read+=ret_code;
87+
}
88+
#else
8389
if (-1 == lseek (fh->fd, iov_offset, SEEK_SET)) {
8490
opal_output(1, "lseek:%s", strerror(errno));
8591
free(iov);
@@ -89,6 +95,7 @@ ssize_t mca_fbtl_posix_preadv (mca_io_ompio_file_t *fh )
8995
if ( 0 < ret_code ) {
9096
bytes_read+=ret_code;
9197
}
98+
#endif
9299
else if ( ret_code == -1 ) {
93100
opal_output(1, "readv:%s", strerror(errno));
94101
free(iov);

ompi/mca/fbtl/posix/fbtl_posix_pwritev.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ ssize_t mca_fbtl_posix_pwritev(mca_io_ompio_file_t *fh )
9393
}
9494
9595
*/
96+
#if defined (HAVE_PWRITEV)
97+
ret_code = pwritev (fh->fd, iov, iov_count, iov_offset);
98+
if ( 0 < ret_code ) {
99+
bytes_written += ret_code;
100+
}
101+
102+
#else
96103
if (-1 == lseek (fh->fd, iov_offset, SEEK_SET)) {
97104
opal_output(1, "lseek:%s", strerror(errno));
98105
free(iov);
@@ -102,6 +109,7 @@ ssize_t mca_fbtl_posix_pwritev(mca_io_ompio_file_t *fh )
102109
if ( 0 < ret_code ) {
103110
bytes_written += ret_code;
104111
}
112+
#endif
105113
else if (-1 == ret_code ) {
106114
opal_output(1, "writev:%s", strerror(errno));
107115
free (iov);

0 commit comments

Comments
 (0)