00001
00002
00003
00004
00005
00006
00007
00008 #include "adio.h"
00009 #include "adio_extern.h"
00010 #include "ad_pvfs.h"
00011
00012 #ifdef HAVE_PVFS_LISTIO
00013 void ADIOI_PVFS_ReadStridedListIO(ADIO_File fd, void *buf, int count,
00014 MPI_Datatype datatype, int file_ptr_type,
00015 ADIO_Offset offset, ADIO_Status *status, int
00016 *error_code);
00017 #endif
00018
00019 void ADIOI_PVFS_ReadContig(ADIO_File fd, void *buf, int count,
00020 MPI_Datatype datatype, int file_ptr_type,
00021 ADIO_Offset offset, ADIO_Status *status, int *error_code)
00022 {
00023 int err=-1, datatype_size, len;
00024 static char myname[] = "ADIOI_PVFS_READCONTIG";
00025
00026 MPI_Type_size(datatype, &datatype_size);
00027 len = datatype_size * count;
00028
00029 if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
00030 if (fd->fp_sys_posn != offset) {
00031 #ifdef ADIOI_MPE_LOGGING
00032 MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );
00033 #endif
00034 pvfs_lseek64(fd->fd_sys, offset, SEEK_SET);
00035 #ifdef ADIOI_MPE_LOGGING
00036 MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL );
00037 #endif
00038 }
00039 #ifdef ADIOI_MPE_LOGGING
00040 MPE_Log_event( ADIOI_MPE_read_a, 0, NULL );
00041 #endif
00042 err = pvfs_read(fd->fd_sys, buf, len);
00043 #ifdef ADIOI_MPE_LOGGING
00044 MPE_Log_event( ADIOI_MPE_read_b, 0, NULL );
00045 #endif
00046 if (err>0)
00047 fd->fp_sys_posn = offset + err;
00048
00049 }
00050 else {
00051 if (fd->fp_sys_posn != fd->fp_ind) {
00052 #ifdef ADIOI_MPE_LOGGING
00053 MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );
00054 #endif
00055 pvfs_lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET);
00056 #ifdef ADIOI_MPE_LOGGING
00057 MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL );
00058 #endif
00059 }
00060 #ifdef ADIOI_MPE_LOGGING
00061 MPE_Log_event( ADIOI_MPE_read_a, 0, NULL );
00062 #endif
00063 err = pvfs_read(fd->fd_sys, buf, len);
00064 #ifdef ADIOI_MPE_LOGGING
00065 MPE_Log_event( ADIOI_MPE_read_b, 0, NULL );
00066 #endif
00067 if (err > 0)
00068 fd->fp_ind += err;
00069 fd->fp_sys_posn = fd->fp_ind;
00070 }
00071
00072 #ifdef HAVE_STATUS_SET_BYTES
00073 if (err != -1) MPIR_Status_set_bytes(status, datatype, err);
00074 #endif
00075
00076 if (err == -1) {
00077 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
00078 myname, __LINE__, MPI_ERR_IO,
00079 "**io",
00080 "**io %s", strerror(errno));
00081 }
00082 else *error_code = MPI_SUCCESS;
00083 }
00084
00085
00086 void ADIOI_PVFS_ReadStrided(ADIO_File fd, void *buf, int count,
00087 MPI_Datatype datatype, int file_ptr_type,
00088 ADIO_Offset offset, ADIO_Status *status, int
00089 *error_code)
00090 {
00091 #ifdef HAVE_PVFS_LISTIO
00092 if ( fd->hints->fs_hints.pvfs.listio_read == ADIOI_HINT_ENABLE) {
00093 ADIOI_PVFS_ReadStridedListIO(fd, buf, count, datatype, file_ptr_type,
00094 offset, status, error_code);
00095 return;
00096 }
00097 #endif
00098
00099 ADIOI_GEN_ReadStrided(fd, buf, count, datatype, file_ptr_type,
00100 offset, status, error_code);
00101 }
00102
00103 #ifdef HAVE_PVFS_LISTIO
00104 void ADIOI_PVFS_ReadStridedListIO(ADIO_File fd, void *buf, int count,
00105 MPI_Datatype datatype, int file_ptr_type,
00106 ADIO_Offset offset, ADIO_Status *status, int
00107 *error_code)
00108 {
00109
00110
00111 ADIOI_Flatlist_node *flat_buf, *flat_file;
00112 int i, j, k, l, brd_size, frd_size=0, st_index=0;
00113 int bufsize, sum, n_etypes_in_filetype, size_in_filetype;
00114 int n_filetypes, etype_in_filetype;
00115 ADIO_Offset abs_off_in_filetype=0;
00116 int filetype_size, etype_size, buftype_size;
00117 MPI_Aint filetype_extent, buftype_extent;
00118 int buf_count, buftype_is_contig, filetype_is_contig;
00119 ADIO_Offset userbuf_off;
00120 ADIO_Offset off, disp, start_off;
00121 int flag, st_frd_size, st_n_filetypes;
00122 int new_brd_size, new_frd_size;
00123
00124 int mem_list_count, file_list_count;
00125 char **mem_offsets;
00126 int64_t *file_offsets;
00127 int *mem_lengths;
00128 int32_t *file_lengths;
00129 int total_blks_to_read;
00130
00131 int max_mem_list, max_file_list;
00132
00133 int b_blks_read;
00134 int f_data_read;
00135 int size_read=0, n_read_lists, extra_blks;
00136
00137 int end_brd_size, end_frd_size;
00138 int start_k, start_j, new_file_read, new_buffer_read;
00139 int start_mem_offset;
00140
00141 #define MAX_ARRAY_SIZE 1024
00142
00143 #ifndef PRINT_ERR_MESG
00144 static char myname[] = "ADIOI_PVFS_ReadStrided";
00145 #endif
00146
00147 *error_code = MPI_SUCCESS;
00148
00149 ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
00150 ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
00151 MPI_Type_size(fd->filetype, &filetype_size);
00152 if ( ! filetype_size ) {
00153 *error_code = MPI_SUCCESS;
00154 return;
00155 }
00156
00157 MPI_Type_extent(fd->filetype, &filetype_extent);
00158 MPI_Type_size(datatype, &buftype_size);
00159 MPI_Type_extent(datatype, &buftype_extent);
00160 etype_size = fd->etype_size;
00161
00162 bufsize = buftype_size * count;
00163
00164 if (!buftype_is_contig && filetype_is_contig) {
00165
00166
00167 int64_t file_offsets;
00168 int32_t file_lengths;
00169
00170 ADIOI_Flatten_datatype(datatype);
00171 flat_buf = ADIOI_Flatlist;
00172 while (flat_buf->type != datatype) flat_buf = flat_buf->next;
00173
00174 off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :
00175 fd->disp + etype_size * offset;
00176
00177 file_list_count = 1;
00178 file_offsets = off;
00179 file_lengths = 0;
00180 total_blks_to_read = count*flat_buf->count;
00181 b_blks_read = 0;
00182
00183
00184 if (total_blks_to_read > MAX_ARRAY_SIZE)
00185 mem_list_count = MAX_ARRAY_SIZE;
00186 else mem_list_count = total_blks_to_read;
00187 mem_offsets = (char**)ADIOI_Malloc(mem_list_count*sizeof(char*));
00188 mem_lengths = (int*)ADIOI_Malloc(mem_list_count*sizeof(int));
00189
00190 j = 0;
00191
00192 while (b_blks_read < total_blks_to_read) {
00193 for (i=0; i<flat_buf->count; i++) {
00194 mem_offsets[b_blks_read % MAX_ARRAY_SIZE] =
00195 (char*)((char *)buf + j*buftype_extent + flat_buf->indices[i]);
00196 mem_lengths[b_blks_read % MAX_ARRAY_SIZE] =
00197 flat_buf->blocklens[i];
00198 file_lengths += flat_buf->blocklens[i];
00199 b_blks_read++;
00200 if (!(b_blks_read % MAX_ARRAY_SIZE) ||
00201 (b_blks_read == total_blks_to_read)) {
00202
00203
00204
00205 if (b_blks_read == total_blks_to_read) {
00206 mem_list_count = total_blks_to_read % MAX_ARRAY_SIZE;
00207
00208 if (!mem_list_count) mem_list_count = MAX_ARRAY_SIZE;
00209 }
00210
00211 pvfs_read_list(fd->fd_sys ,mem_list_count, mem_offsets,
00212 mem_lengths, file_list_count,
00213 &file_offsets, &file_lengths);
00214
00215
00216 if (b_blks_read == total_blks_to_read) break;
00217
00218 file_offsets += file_lengths;
00219 file_lengths = 0;
00220 }
00221 }
00222 j++;
00223 }
00224 ADIOI_Free(mem_offsets);
00225 ADIOI_Free(mem_lengths);
00226
00227 if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off;
00228
00229 fd->fp_sys_posn = -1;
00230
00231 #ifdef HAVE_STATUS_SET_BYTES
00232 MPIR_Status_set_bytes(status, datatype, bufsize);
00233
00234
00235
00236 #endif
00237 ADIOI_Delete_flattened(datatype);
00238
00239 return;
00240 }
00241
00242
00243
00244
00245
00246 flat_file = ADIOI_Flatlist;
00247 while (flat_file->type != fd->filetype) flat_file = flat_file->next;
00248
00249 disp = fd->disp;
00250
00251
00252
00253
00254
00255
00256 if (file_ptr_type == ADIO_INDIVIDUAL) {
00257 offset = fd->fp_ind;
00258 n_filetypes = -1;
00259 flag = 0;
00260 while (!flag) {
00261 n_filetypes++;
00262 for (i=0; i<flat_file->count; i++) {
00263 if (disp + flat_file->indices[i] +
00264 (ADIO_Offset) n_filetypes*filetype_extent +
00265 flat_file->blocklens[i] >= offset) {
00266 st_index = i;
00267 frd_size = (int) (disp + flat_file->indices[i] +
00268 (ADIO_Offset) n_filetypes*filetype_extent
00269 + flat_file->blocklens[i] - offset);
00270 flag = 1;
00271 break;
00272 }
00273 }
00274 }
00275 }
00276 else {
00277 n_etypes_in_filetype = filetype_size/etype_size;
00278 n_filetypes = (int) (offset / n_etypes_in_filetype);
00279 etype_in_filetype = (int) (offset % n_etypes_in_filetype);
00280 size_in_filetype = etype_in_filetype * etype_size;
00281
00282 sum = 0;
00283 for (i=0; i<flat_file->count; i++) {
00284 sum += flat_file->blocklens[i];
00285 if (sum > size_in_filetype) {
00286 st_index = i;
00287 frd_size = sum - size_in_filetype;
00288 abs_off_in_filetype = flat_file->indices[i] +
00289 size_in_filetype - (sum - flat_file->blocklens[i]);
00290 break;
00291 }
00292 }
00293
00294
00295 offset = disp + (ADIO_Offset) n_filetypes*filetype_extent +
00296 abs_off_in_filetype;
00297 }
00298
00299 start_off = offset;
00300 st_frd_size = frd_size;
00301 st_n_filetypes = n_filetypes;
00302
00303 if (buftype_is_contig && !filetype_is_contig) {
00304
00305
00306
00307
00308 int mem_lengths;
00309 char *mem_offsets;
00310
00311 i = 0;
00312 j = st_index;
00313 n_filetypes = st_n_filetypes;
00314
00315 mem_list_count = 1;
00316
00317
00318 f_data_read = ADIOI_MIN(st_frd_size, bufsize);
00319 total_blks_to_read = 1;
00320 j++;
00321 while (f_data_read < bufsize) {
00322 f_data_read += flat_file->blocklens[j];
00323 total_blks_to_read++;
00324 if (j<(flat_file->count-1)) j++;
00325 else j = 0;
00326 }
00327
00328 j = st_index;
00329 n_filetypes = st_n_filetypes;
00330 n_read_lists = total_blks_to_read/MAX_ARRAY_SIZE;
00331 extra_blks = total_blks_to_read%MAX_ARRAY_SIZE;
00332
00333 mem_offsets = buf;
00334 mem_lengths = 0;
00335
00336
00337
00338 if (n_read_lists) {
00339 file_offsets = (int64_t*)ADIOI_Malloc(MAX_ARRAY_SIZE*
00340 sizeof(int64_t));
00341 file_lengths = (int32_t*)ADIOI_Malloc(MAX_ARRAY_SIZE*
00342 sizeof(int32_t));
00343 }
00344
00345
00346 else {
00347 file_offsets = (int64_t*)ADIOI_Malloc(extra_blks*
00348 sizeof(int64_t));
00349 file_lengths = (int32_t*)ADIOI_Malloc(extra_blks*
00350 sizeof(int32_t));
00351 }
00352
00353
00354 for (i=0; i<n_read_lists; i++) {
00355 file_list_count = MAX_ARRAY_SIZE;
00356 if(!i) {
00357 file_offsets[0] = offset;
00358 file_lengths[0] = st_frd_size;
00359 mem_lengths = st_frd_size;
00360 }
00361 for (k=0; k<MAX_ARRAY_SIZE; k++) {
00362 if (i || k) {
00363 file_offsets[k] = disp + n_filetypes*filetype_extent
00364 + flat_file->indices[j];
00365 file_lengths[k] = flat_file->blocklens[j];
00366 mem_lengths += file_lengths[k];
00367 }
00368 if (j<(flat_file->count - 1)) j++;
00369 else {
00370 j = 0;
00371 n_filetypes++;
00372 }
00373 }
00374 pvfs_read_list(fd->fd_sys, mem_list_count,
00375 &mem_offsets, &mem_lengths,
00376 file_list_count, file_offsets,
00377 file_lengths);
00378 mem_offsets += mem_lengths;
00379 mem_lengths = 0;
00380 }
00381
00382
00383 if (extra_blks) {
00384 file_list_count = extra_blks;
00385 if(!i) {
00386 file_offsets[0] = offset;
00387 file_lengths[0] = st_frd_size;
00388 }
00389 for (k=0; k<extra_blks; k++) {
00390 if(i || k) {
00391 file_offsets[k] = disp + n_filetypes*filetype_extent +
00392 flat_file->indices[j];
00393 if (k == (extra_blks - 1)) {
00394 file_lengths[k] = bufsize - (int32_t) mem_lengths
00395 - (int32_t) mem_offsets + (int32_t) buf;
00396 }
00397 else file_lengths[k] = flat_file->blocklens[j];
00398 }
00399 mem_lengths += file_lengths[k];
00400 if (j<(flat_file->count - 1)) j++;
00401 else {
00402 j = 0;
00403 n_filetypes++;
00404 }
00405 }
00406 pvfs_read_list(fd->fd_sys, mem_list_count, &mem_offsets,
00407 &mem_lengths, file_list_count, file_offsets,
00408 file_lengths);
00409 }
00410 }
00411 else {
00412
00413
00414 ADIOI_Flatten_datatype(datatype);
00415 flat_buf = ADIOI_Flatlist;
00416 while (flat_buf->type != datatype) flat_buf = flat_buf->next;
00417
00418 size_read = 0;
00419 n_filetypes = st_n_filetypes;
00420 frd_size = st_frd_size;
00421 brd_size = flat_buf->blocklens[0];
00422 buf_count = 0;
00423 start_mem_offset = 0;
00424 start_k = k = 0;
00425 start_j = st_index;
00426 max_mem_list = 0;
00427 max_file_list = 0;
00428
00429
00430
00431
00432
00433 while (size_read < bufsize) {
00434 k = start_k;
00435 new_buffer_read = 0;
00436 mem_list_count = 0;
00437 while ((mem_list_count < MAX_ARRAY_SIZE) &&
00438 (new_buffer_read < bufsize-size_read)) {
00439
00440
00441
00442
00443
00444 if(mem_list_count) {
00445 if((new_buffer_read + flat_buf->blocklens[k] +
00446 size_read) > bufsize) {
00447 end_brd_size = new_buffer_read +
00448 flat_buf->blocklens[k] - (bufsize - size_read);
00449 new_buffer_read = bufsize - size_read;
00450 }
00451 else {
00452 new_buffer_read += flat_buf->blocklens[k];
00453 end_brd_size = flat_buf->blocklens[k];
00454 }
00455 }
00456 else {
00457 if (brd_size > (bufsize - size_read)) {
00458 new_buffer_read = bufsize - size_read;
00459 brd_size = new_buffer_read;
00460 }
00461 else new_buffer_read = brd_size;
00462 }
00463 mem_list_count++;
00464 k = (k + 1)%flat_buf->count;
00465 }
00466
00467 j = start_j;
00468 new_file_read = 0;
00469 file_list_count = 0;
00470 while ((file_list_count < MAX_ARRAY_SIZE) &&
00471 (new_file_read < new_buffer_read)) {
00472 if(file_list_count) {
00473 if((new_file_read + flat_file->blocklens[j]) >
00474 new_buffer_read) {
00475 end_frd_size = new_buffer_read - new_file_read;
00476 new_file_read = new_buffer_read;
00477 j--;
00478 }
00479 else {
00480 new_file_read += flat_file->blocklens[j];
00481 end_frd_size = flat_file->blocklens[j];
00482 }
00483 }
00484 else {
00485 if (frd_size > new_buffer_read) {
00486 new_file_read = new_buffer_read;
00487 frd_size = new_file_read;
00488 }
00489 else new_file_read = frd_size;
00490 }
00491 file_list_count++;
00492 if (j < (flat_file->count - 1)) j++;
00493 else j = 0;
00494
00495 k = start_k;
00496 if ((new_file_read < new_buffer_read) &&
00497 (file_list_count == MAX_ARRAY_SIZE)) {
00498 new_buffer_read = 0;
00499 mem_list_count = 0;
00500 while (new_buffer_read < new_file_read) {
00501 if(mem_list_count) {
00502 if((new_buffer_read + flat_buf->blocklens[k]) >
00503 new_file_read) {
00504 end_brd_size = new_file_read - new_buffer_read;
00505 new_buffer_read = new_file_read;
00506 k--;
00507 }
00508 else {
00509 new_buffer_read += flat_buf->blocklens[k];
00510 end_brd_size = flat_buf->blocklens[k];
00511 }
00512 }
00513 else {
00514 new_buffer_read = brd_size;
00515 if (brd_size > (bufsize - size_read)) {
00516 new_buffer_read = bufsize - size_read;
00517 brd_size = new_buffer_read;
00518 }
00519 }
00520 mem_list_count++;
00521 k = (k + 1)%flat_buf->count;
00522 }
00523 }
00524
00525 }
00526
00527
00528
00529 k = start_k;
00530 j = start_j;
00531 for (i=0; i<mem_list_count; i++) {
00532 if(i) {
00533 if (i == (mem_list_count - 1)) {
00534 if (flat_buf->blocklens[k] == end_brd_size)
00535 brd_size = flat_buf->blocklens[(k+1)%
00536 flat_buf->count];
00537 else {
00538 brd_size = flat_buf->blocklens[k] - end_brd_size;
00539 k--;
00540 buf_count--;
00541 }
00542 }
00543 }
00544 buf_count++;
00545 k = (k + 1)%flat_buf->count;
00546 }
00547 for (i=0; i<file_list_count; i++) {
00548 if (i) {
00549 if (i == (file_list_count - 1)) {
00550 if (flat_file->blocklens[j] == end_frd_size)
00551 frd_size = flat_file->blocklens[(j+1)%
00552 flat_file->count];
00553 else {
00554 frd_size = flat_file->blocklens[j] - end_frd_size;
00555 j--;
00556 }
00557 }
00558 }
00559 if (j < flat_file->count - 1) j++;
00560 else {
00561 j = 0;
00562 n_filetypes++;
00563 }
00564 }
00565 size_read += new_buffer_read;
00566 start_k = k;
00567 start_j = j;
00568 if (max_mem_list < mem_list_count)
00569 max_mem_list = mem_list_count;
00570 if (max_file_list < file_list_count)
00571 max_file_list = file_list_count;
00572 }
00573
00574 mem_offsets = (char **)ADIOI_Malloc(max_mem_list*sizeof(char *));
00575 mem_lengths = (int *)ADIOI_Malloc(max_mem_list*sizeof(int));
00576 file_offsets = (int64_t *)ADIOI_Malloc(max_file_list*sizeof(int64_t));
00577 file_lengths = (int32_t *)ADIOI_Malloc(max_file_list*sizeof(int32_t));
00578
00579 size_read = 0;
00580 n_filetypes = st_n_filetypes;
00581 frd_size = st_frd_size;
00582 brd_size = flat_buf->blocklens[0];
00583 buf_count = 0;
00584 start_mem_offset = 0;
00585 start_k = k = 0;
00586 start_j = st_index;
00587
00588
00589
00590
00591
00592 while (size_read < bufsize) {
00593 k = start_k;
00594 new_buffer_read = 0;
00595 mem_list_count = 0;
00596 while ((mem_list_count < MAX_ARRAY_SIZE) &&
00597 (new_buffer_read < bufsize-size_read)) {
00598
00599
00600
00601
00602
00603 if(mem_list_count) {
00604 if((new_buffer_read + flat_buf->blocklens[k] +
00605 size_read) > bufsize) {
00606 end_brd_size = new_buffer_read +
00607 flat_buf->blocklens[k] - (bufsize - size_read);
00608 new_buffer_read = bufsize - size_read;
00609 }
00610 else {
00611 new_buffer_read += flat_buf->blocklens[k];
00612 end_brd_size = flat_buf->blocklens[k];
00613 }
00614 }
00615 else {
00616 if (brd_size > (bufsize - size_read)) {
00617 new_buffer_read = bufsize - size_read;
00618 brd_size = new_buffer_read;
00619 }
00620 else new_buffer_read = brd_size;
00621 }
00622 mem_list_count++;
00623 k = (k + 1)%flat_buf->count;
00624 }
00625
00626 j = start_j;
00627 new_file_read = 0;
00628 file_list_count = 0;
00629 while ((file_list_count < MAX_ARRAY_SIZE) &&
00630 (new_file_read < new_buffer_read)) {
00631 if(file_list_count) {
00632 if((new_file_read + flat_file->blocklens[j]) >
00633 new_buffer_read) {
00634 end_frd_size = new_buffer_read - new_file_read;
00635 new_file_read = new_buffer_read;
00636 j--;
00637 }
00638 else {
00639 new_file_read += flat_file->blocklens[j];
00640 end_frd_size = flat_file->blocklens[j];
00641 }
00642 }
00643 else {
00644 if (frd_size > new_buffer_read) {
00645 new_file_read = new_buffer_read;
00646 frd_size = new_file_read;
00647 }
00648 else new_file_read = frd_size;
00649 }
00650 file_list_count++;
00651 if (j < (flat_file->count - 1)) j++;
00652 else j = 0;
00653
00654 k = start_k;
00655 if ((new_file_read < new_buffer_read) &&
00656 (file_list_count == MAX_ARRAY_SIZE)) {
00657 new_buffer_read = 0;
00658 mem_list_count = 0;
00659 while (new_buffer_read < new_file_read) {
00660 if(mem_list_count) {
00661 if((new_buffer_read + flat_buf->blocklens[k]) >
00662 new_file_read) {
00663 end_brd_size = new_file_read - new_buffer_read;
00664 new_buffer_read = new_file_read;
00665 k--;
00666 }
00667 else {
00668 new_buffer_read += flat_buf->blocklens[k];
00669 end_brd_size = flat_buf->blocklens[k];
00670 }
00671 }
00672 else {
00673 new_buffer_read = brd_size;
00674 if (brd_size > (bufsize - size_read)) {
00675 new_buffer_read = bufsize - size_read;
00676 brd_size = new_buffer_read;
00677 }
00678 }
00679 mem_list_count++;
00680 k = (k + 1)%flat_buf->count;
00681 }
00682 }
00683
00684 }
00685
00686
00687
00688 k = start_k;
00689 j = start_j;
00690 for (i=0; i<mem_list_count; i++) {
00691 mem_offsets[i] = (char*)((char *)buf + buftype_extent*
00692 (buf_count/flat_buf->count) +
00693 (int)flat_buf->indices[k]);
00694 if(!i) {
00695 mem_lengths[0] = brd_size;
00696 mem_offsets[0] += flat_buf->blocklens[k] - brd_size;
00697 }
00698 else {
00699 if (i == (mem_list_count - 1)) {
00700 mem_lengths[i] = end_brd_size;
00701 if (flat_buf->blocklens[k] == end_brd_size)
00702 brd_size = flat_buf->blocklens[(k+1)%
00703 flat_buf->count];
00704 else {
00705 brd_size = flat_buf->blocklens[k] - end_brd_size;
00706 k--;
00707 buf_count--;
00708 }
00709 }
00710 else {
00711 mem_lengths[i] = flat_buf->blocklens[k];
00712 }
00713 }
00714 buf_count++;
00715 k = (k + 1)%flat_buf->count;
00716 }
00717 for (i=0; i<file_list_count; i++) {
00718 file_offsets[i] = disp + flat_file->indices[j] + n_filetypes *
00719 filetype_extent;
00720 if (!i) {
00721 file_lengths[0] = frd_size;
00722 file_offsets[0] += flat_file->blocklens[j] - frd_size;
00723 }
00724 else {
00725 if (i == (file_list_count - 1)) {
00726 file_lengths[i] = end_frd_size;
00727 if (flat_file->blocklens[j] == end_frd_size)
00728 frd_size = flat_file->blocklens[(j+1)%
00729 flat_file->count];
00730 else {
00731 frd_size = flat_file->blocklens[j] - end_frd_size;
00732 j--;
00733 }
00734 }
00735 else file_lengths[i] = flat_file->blocklens[j];
00736 }
00737 if (j < flat_file->count - 1) j++;
00738 else {
00739 j = 0;
00740 n_filetypes++;
00741 }
00742 }
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759 pvfs_read_list(fd->fd_sys,mem_list_count, mem_offsets,
00760 mem_lengths, file_list_count, file_offsets,
00761 file_lengths);
00762 size_read += new_buffer_read;
00763 start_k = k;
00764 start_j = j;
00765 }
00766 ADIOI_Free(mem_offsets);
00767 ADIOI_Free(mem_lengths);
00768 }
00769 ADIOI_Free(file_offsets);
00770 ADIOI_Free(file_lengths);
00771
00772 if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off;
00773 fd->fp_sys_posn = -1;
00774
00775 #ifdef HAVE_STATUS_SET_BYTES
00776 MPIR_Status_set_bytes(status, datatype, bufsize);
00777
00778
00779
00780 #endif
00781
00782 if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
00783 }
00784 #endif