1
1

fbtl/posix: make the code compile

Signed-off-by: Edgar Gabriel <egabriel@central.uh.edu>
Этот коммит содержится в:
Edgar Gabriel 2017-09-20 17:57:57 -05:00
родитель f5e158c869
Коммит 415e76514d
5 изменённых файлов: 27 добавлений и 17 удалений

Просмотреть файл

@ -58,6 +58,11 @@ ssize_t mca_fbtl_posix_ipwritev (mca_io_ompio_file_t *file,
bool mca_fbtl_posix_progress ( mca_ompio_request_t *req);
void mca_fbtl_posix_request_free ( mca_ompio_request_t *req);
int mca_fbtl_posix_lock ( struct flock *lock, mca_io_ompio_file_t *fh, int op,
OMPI_MPI_OFFSET_TYPE iov_offset, off_t len, int flags);
int mca_fbtl_posix_unlock ( struct flock *lock, mca_io_ompio_file_t *fh );
struct mca_fbtl_posix_request_data_t {
int aio_req_count; /* total number of aio reqs */
int aio_open_reqs; /* number of unfinished reqs */
@ -78,6 +83,7 @@ typedef struct mca_fbtl_posix_request_data_t mca_fbtl_posix_request_data_t;
#define FBTL_POSIX_READ 1
#define FBTL_POSIX_WRITE 2
/*
* ******************************************************************
* ************ functions implemented in this module end ************

Просмотреть файл

@ -35,7 +35,7 @@
*/
int mca_fbtl_posix_lock ( struct flock *lock, mca_io_ompio_file_t *fh, int op,
OMPI_MPI_OFFSET_TYPE iov_offset, off_t len, int flags)
OMPI_MPI_OFFSET_TYPE offset, off_t len, int flags)
{
off_t lmod, bmod;
@ -46,7 +46,7 @@ int mca_fbtl_posix_lock ( struct flock *lock, mca_io_ompio_file_t *fh, int op,
if ( fh->f_atomicity ||
fh->f_flags & OMPIO_LOCK_ALWAYS ) {
/* Need to lock the entire region */
lock->l_start = (off_t) iov_offset;
lock->l_start = (off_t) offset;
lock->l_len = len;
}
else {
@ -67,7 +67,7 @@ int mca_fbtl_posix_lock ( struct flock *lock, mca_io_ompio_file_t *fh, int op,
return 0;
}
if ( OMPIO_LOCK_ENTIRE_REGION ) {
lock->l_start = (off_t) iov_offset;
lock->l_start = (off_t) offset;
lock->l_len = len;
}
else {
@ -80,7 +80,7 @@ int mca_fbtl_posix_lock ( struct flock *lock, mca_io_ompio_file_t *fh, int op,
*/
bmod = offset % fh->f_fs_block_size;
if ( !bmod ) {
lock->l_start = (off_t) iov_offset;
lock->l_start = (off_t) offset;
lock->l_len = fh->f_fs_block_size - bmod;
}
lmod = (offset+len-1)%fh->f_fs_block_size;

Просмотреть файл

@ -83,24 +83,22 @@ ssize_t mca_fbtl_posix_preadv (mca_io_ompio_file_t *fh )
continue;
}
}
mca_fbtl_posix_lock ( &lock, fh, F_RDLCK, iov_offset, total_len, OMPIO_LOCK_SELECTIVE );
mca_fbtl_posix_lock ( &lock, fh, F_RDLCK, iov_offset, total_length, OMPIO_LOCK_SELECTIVE );
#if defined(HAVE_PREADV)
ret_code = preadv (fh->fd, iov, iov_count, iov_offset);
if ( 0 < ret_code ) {
bytes_read+=ret_code;
}
#else
if (-1 == lseek (fh->fd, iov_offset, SEEK_SET)) {
opal_output(1, "lseek:%s", strerror(errno));
free(iov);
mca_fbtl_posix_unlock ( &lock, fh );
return OMPI_ERROR;
}
ret_code = readv (fh->fd, iov, iov_count);
#endif
mca_fbtl_posix_unlock ( &lock, fh );
if ( 0 < ret_code ) {
bytes_read+=ret_code;
}
#endif
mca_fbtl_posix_unlock ( &lock, fh );
else if ( ret_code == -1 ) {
opal_output(1, "readv:%s", strerror(errno));
free(iov);

Просмотреть файл

@ -97,25 +97,22 @@ ssize_t mca_fbtl_posix_pwritev(mca_io_ompio_file_t *fh )
*/
mca_fbtl_posix_lock ( &lock, fh, F_WRLCK, iov_offset, total_len, OMPIO_LOCK_SELECTIVE );
mca_fbtl_posix_lock ( &lock, fh, F_WRLCK, iov_offset, total_length, OMPIO_LOCK_SELECTIVE );
#if defined (HAVE_PWRITEV)
ret_code = pwritev (fh->fd, iov, iov_count, iov_offset);
if ( 0 < ret_code ) {
bytes_written += ret_code;
}
#else
if (-1 == lseek (fh->fd, iov_offset, SEEK_SET)) {
opal_output(1, "lseek:%s", strerror(errno));
free(iov);
mca_fbtl_posix_unlock ( &lock, fh );
return OMPI_ERROR;
}
ret_code = writev (fh->fd, iov, iov_count);
#endif
mca_fbtl_posix_unlock ( &lock, fh );
if ( 0 < ret_code ) {
bytes_written += ret_code;
}
#endif
mca_fbtl_posix_unlock ( &lock, fh );
else if (-1 == ret_code ) {
opal_output(1, "writev:%s", strerror(errno));
free (iov);

Просмотреть файл

@ -64,6 +64,10 @@ OMPI_DECLSPEC extern int mca_io_ompio_coll_timing_info;
#define OMPIO_CONTIGUOUS_FVIEW 0x00000010
#define OMPIO_AGGREGATOR_IS_SET 0x00000020
#define OMPIO_SHAREDFP_IS_SET 0x00000040
#define OMPIO_LOCK_ALWAYS 0x00000080
#define OMPIO_LOCK_NEVER 0x00000100
#define OMPIO_LOCK_NOT_THIS_OP 0x00000200
#define QUEUESIZE 2048
#define MCA_IO_DEFAULT_FILE_VIEW_SIZE 4*1024*1024
@ -121,6 +125,10 @@ OMPI_DECLSPEC extern int mca_io_ompio_coll_timing_info;
#define OMPIO_PROCS_IN_GROUP_TAG 1
#define OMPIO_MERGE_THRESHOLD 0.5
#define OMPIO_LOCK_ENTIRE_REGION 10
#define OMPIO_LOCK_SELECTIVE 11
/*---------------------------*/
BEGIN_C_DECLS
@ -216,6 +224,7 @@ struct mca_io_ompio_file_t {
opal_info_t *f_info;
int32_t f_flags;
void *f_fs_ptr;
int f_fs_block_size;
int f_atomicity;
size_t f_stripe_size;
int f_stripe_count;