@@ -33,7 +33,6 @@ static ssize_t mca_fbtl_posix_preadv_datasieving (ompio_file_t *fh, struct flock
3333static ssize_t mca_fbtl_posix_preadv_generic (ompio_file_t * fh , struct flock * lock , int * lock_counter );
3434static ssize_t mca_fbtl_posix_preadv_single (ompio_file_t * fh , struct flock * lock , int * lock_counter );
3535
36- #define MAX_RETRIES 10
3736
3837ssize_t mca_fbtl_posix_preadv (ompio_file_t * fh )
3938{
@@ -108,7 +107,6 @@ ssize_t mca_fbtl_posix_preadv_single (ompio_file_t *fh, struct flock *lock, int
108107 return OMPI_ERROR ;
109108 }
110109
111- int retries = 0 ;
112110 size_t len = fh -> f_io_array [0 ].length ;
113111 while ( total_bytes < len ) {
114112 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
121119 }
122120 if ( ret_code == 0 ) {
123121 // end of file
124- retries ++ ;
125- if ( retries == MAX_RETRIES ) {
126- break ;
127- }
128- else {
129- continue ;
130- }
122+ break ;
131123 }
132124 total_bytes += ret_code ;
133125 }
@@ -206,7 +198,6 @@ ssize_t mca_fbtl_posix_preadv_datasieving (ompio_file_t *fh, struct flock *lock,
206198 return OMPI_ERROR ;
207199 }
208200 size_t total_bytes = 0 ;
209- int retries = 0 ;
210201
211202 while ( total_bytes < len ) {
212203 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,
218209 }
219210 if ( ret_code == 0 ) {
220211 // end of file
221- retries ++ ;
222- if ( retries == MAX_RETRIES ) {
223- break ;
224- }
225- else {
226- continue ;
227- }
212+ break ;
228213 }
229214 total_bytes += ret_code ;
230215 }
@@ -236,12 +221,12 @@ ssize_t mca_fbtl_posix_preadv_datasieving (ompio_file_t *fh, struct flock *lock,
236221 size_t start_offset = (size_t ) fh -> f_io_array [startindex ].offset ;
237222 for ( i = startindex ; i < endindex ; i ++ ) {
238223 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 ) {
240225 break ;
241226 }
242227 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 ;
245230 }
246231
247232 memcpy (fh -> f_io_array [i ].memory_address , temp_buf + pos , num_bytes );
0 commit comments