This source file includes following definitions.
- ZOIDFS_IOContig
- ADIOI_ZOIDFS_ReadContig
- ADIOI_ZOIDFS_WriteContig
1
2
3
4
5
6
7 #include "adio.h"
8 #include "adio_extern.h"
9 #include "ad_zoidfs.h"
10
11 #include "ad_zoidfs_common.h"
12
13 #define ZOIDFS_READ 0
14 #define ZOIDFS_WRITE 1
15
16 static void ZOIDFS_IOContig(ADIO_File fd, void * buf, int count,
17 MPI_Datatype datatype, int file_ptr_type,
18 ADIO_Offset offset, ADIO_Status *status,
19 int flag, int *error_code)
20 {
21 int ret;
22 MPI_Count datatype_size;
23 uint64_t file_len;
24 size_t mem_len;
25 ADIOI_ZOIDFS_object *zoidfs_obj_ptr;
26 uint64_t file_offset = offset;
27 static char myname[] = "ADIOI_ZOIDFS_IOCONTIG";
28
29 zoidfs_obj_ptr = (ADIOI_ZOIDFS_object*)fd->fs_ptr;
30
31 MPI_Type_size_x(datatype, &datatype_size);
32 file_len = mem_len = datatype_size * count;
33
34 if (file_ptr_type == ADIO_INDIVIDUAL) {
35 file_offset = fd->fp_ind;
36 }
37
38 if (flag == ZOIDFS_READ) {
39 NO_STALE(ret, fd, zoidfs_obj_ptr,
40 zoidfs_read(zoidfs_obj_ptr,
41 1, &buf, &mem_len,
42 1, &file_offset, &file_len, ZOIDFS_NO_OP_HINT));
43 } else {
44 NO_STALE(ret, fd, zoidfs_obj_ptr,
45 zoidfs_write(zoidfs_obj_ptr,
46 1, (const void **)&buf, &mem_len,
47 1, &file_offset, &file_len, ZOIDFS_NO_OP_HINT));
48 }
49
50 if (ret != ZFS_OK ) {
51 *error_code = MPIO_Err_create_code(MPI_SUCCESS,
52 MPIR_ERR_RECOVERABLE,
53 myname, __LINE__,
54 ADIOI_ZOIDFS_error_convert(ret),
55 "Error in ZOIDFS I/O", 0);
56 goto fn_exit;
57 }
58
59
60 if (file_ptr_type == ADIO_INDIVIDUAL) {
61 fd->fp_ind += file_len;
62 }
63 fd->fp_sys_posn = file_offset + file_len;
64
65 #ifdef HAVE_STATUS_SET_BYTES
66 MPIR_Status_set_bytes(status, datatype, file_len);
67 #endif
68
69 *error_code = MPI_SUCCESS;
70
71 fn_exit:
72 return;
73 }
74
75 void ADIOI_ZOIDFS_ReadContig(ADIO_File fd, void *buf, int count,
76 MPI_Datatype datatype, int file_ptr_type,
77 ADIO_Offset offset, ADIO_Status *status,
78 int *error_code)
79 {
80 ZOIDFS_IOContig(fd, buf, count, datatype, file_ptr_type,
81 offset, status, ZOIDFS_READ, error_code);
82 }
83
84 void ADIOI_ZOIDFS_WriteContig(ADIO_File fd, void *buf, int count,
85 MPI_Datatype datatype, int file_ptr_type,
86 ADIO_Offset offset, ADIO_Status *status,
87 int *error_code)
88 {
89 ZOIDFS_IOContig(fd, buf, count, datatype, file_ptr_type,
90 offset, status, ZOIDFS_WRITE, error_code);
91 }
92
93
94
95
96