@@ -33,7 +33,6 @@ static ssize_t mca_fbtl_posix_preadv_datasieving (ompio_file_t *fh, struct flock
33
33
static ssize_t mca_fbtl_posix_preadv_generic (ompio_file_t * fh , struct flock * lock , int * lock_counter );
34
34
static ssize_t mca_fbtl_posix_preadv_single (ompio_file_t * fh , struct flock * lock , int * lock_counter );
35
35
36
- #define MAX_RETRIES 10
37
36
38
37
ssize_t mca_fbtl_posix_preadv (ompio_file_t * fh )
39
38
{
@@ -108,7 +107,6 @@ ssize_t mca_fbtl_posix_preadv_single (ompio_file_t *fh, struct flock *lock, int
108
107
return OMPI_ERROR ;
109
108
}
110
109
111
- int retries = 0 ;
112
110
size_t len = fh -> f_io_array [0 ].length ;
113
111
while ( total_bytes < len ) {
114
112
ret_code = pread (fh -> fd , (char * )fh -> f_io_array [0 ].memory_address + total_bytes ,
@@ -121,13 +119,7 @@ ssize_t mca_fbtl_posix_preadv_single (ompio_file_t *fh, struct flock *lock, int
121
119
}
122
120
if ( ret_code == 0 ) {
123
121
// end of file
124
- retries ++ ;
125
- if ( retries == MAX_RETRIES ) {
126
- break ;
127
- }
128
- else {
129
- continue ;
130
- }
122
+ break ;
131
123
}
132
124
total_bytes += ret_code ;
133
125
}
@@ -206,7 +198,6 @@ ssize_t mca_fbtl_posix_preadv_datasieving (ompio_file_t *fh, struct flock *lock,
206
198
return OMPI_ERROR ;
207
199
}
208
200
size_t total_bytes = 0 ;
209
- int retries = 0 ;
210
201
211
202
while ( total_bytes < len ) {
212
203
ret_code = pread (fh -> fd , temp_buf + total_bytes , len - total_bytes , start + total_bytes );
@@ -218,13 +209,7 @@ ssize_t mca_fbtl_posix_preadv_datasieving (ompio_file_t *fh, struct flock *lock,
218
209
}
219
210
if ( ret_code == 0 ) {
220
211
// end of file
221
- retries ++ ;
222
- if ( retries == MAX_RETRIES ) {
223
- break ;
224
- }
225
- else {
226
- continue ;
227
- }
212
+ break ;
228
213
}
229
214
total_bytes += ret_code ;
230
215
}
@@ -236,12 +221,12 @@ ssize_t mca_fbtl_posix_preadv_datasieving (ompio_file_t *fh, struct flock *lock,
236
221
size_t start_offset = (size_t ) fh -> f_io_array [startindex ].offset ;
237
222
for ( i = startindex ; i < endindex ; i ++ ) {
238
223
pos = (size_t ) fh -> f_io_array [i ].offset - start_offset ;
239
- if ( (ssize_t ) pos > ret_code ) {
224
+ if ( (ssize_t ) pos > total_bytes ) {
240
225
break ;
241
226
}
242
227
num_bytes = fh -> f_io_array [i ].length ;
243
- if ( ((ssize_t ) pos + (ssize_t )num_bytes ) > ret_code ) {
244
- num_bytes = ret_code - (ssize_t )pos ;
228
+ if ( ((ssize_t ) pos + (ssize_t )num_bytes ) > total_bytes ) {
229
+ num_bytes = total_bytes - (ssize_t )pos ;
245
230
}
246
231
247
232
memcpy (fh -> f_io_array [i ].memory_address , temp_buf + pos , num_bytes );
0 commit comments