00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "ad_xfs.h"
00010
00011 void ADIOI_XFS_IreadContig(ADIO_File fd, void *buf, int count,
00012 MPI_Datatype datatype, int file_ptr_type,
00013 ADIO_Offset offset, ADIO_Request *request, int *error_code)
00014 {
00015 int len, typesize, err=-1;
00016 #ifndef PRINT_ERR_MSG
00017 static char myname[] = "ADIOI_XFS_IREADCONTIG";
00018 #endif
00019
00020 (*request) = ADIOI_Malloc_request();
00021 (*request)->optype = ADIOI_READ;
00022 (*request)->fd = fd;
00023 (*request)->datatype = datatype;
00024
00025 MPI_Type_size(datatype, &typesize);
00026 len = count * typesize;
00027
00028 if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind;
00029 err = ADIOI_XFS_aio(fd, buf, len, offset, 0, &((*request)->handle));
00030 if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len;
00031
00032 (*request)->queued = 1;
00033 ADIOI_Add_req_to_list(request);
00034
00035 #ifdef PRINT_ERR_MSG
00036 *error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
00037 #else
00038 if (err == -1) {
00039 *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
00040 myname, "I/O Error", "%s", strerror(errno));
00041 ADIOI_Error(fd, *error_code, myname);
00042 }
00043 else *error_code = MPI_SUCCESS;
00044 #endif
00045
00046 fd->fp_sys_posn = -1;
00047 fd->async_count++;
00048 }
00049
00050
00051
00052 void ADIOI_XFS_IreadStrided(ADIO_File fd, void *buf, int count,
00053 MPI_Datatype datatype, int file_ptr_type,
00054 ADIO_Offset offset, ADIO_Request *request, int
00055 *error_code)
00056 {
00057 ADIO_Status status;
00058 #ifdef HAVE_STATUS_SET_BYTES
00059 int typesize;
00060 #endif
00061
00062 *request = ADIOI_Malloc_request();
00063 (*request)->optype = ADIOI_READ;
00064 (*request)->fd = fd;
00065 (*request)->datatype = datatype;
00066 (*request)->queued = 0;
00067 (*request)->handle = 0;
00068
00069
00070 ADIOI_XFS_ReadStrided(fd, buf, count, datatype, file_ptr_type,
00071 offset, &status, error_code);
00072
00073 fd->async_count++;
00074
00075 #ifdef HAVE_STATUS_SET_BYTES
00076 if (*error_code == MPI_SUCCESS) {
00077 MPI_Type_size(datatype, &typesize);
00078 (*request)->nbytes = count * typesize;
00079 }
00080 #endif
00081 }