[mpich-discuss] ROMIO: ADIOI_Calc_my_off_len (patch proposed for adio/comm/ad_read_coll.c)

Pascal Deveze Pascal.Deveze at bull.net
Tue Jul 27 07:47:09 CDT 2010


At line 379 of adio/common/ad_read_coll.c, if flat_file->blocklens[i] is 
null, the code continue.
But in the case where i is null (first loop), the first calculated 
offset is false.

  369          if (file_ptr_type == ADIO_INDIVIDUAL) {
   370             /* Wei-keng reworked type processing to be a bit more 
efficient */
   371              offset       = fd->fp_ind - disp;
   372              n_filetypes  = (offset - flat_file->indices[0]) / 
filetype_extent;
   373               offset     -= (ADIO_Offset)n_filetypes * 
filetype_extent;
   374                  /* now offset is local to this extent */
   375
   376              /* find the block where offset is located, skip 
blocklens[i]==0 */
   377              for (i=0; i<flat_file->count; i++) {
   378                  ADIO_Offset dist;
   379                  if (flat_file->blocklens[i] == 0) continue;
   380                  dist = flat_file->indices[i] + 
flat_file->blocklens[i] - offset;
   381                  /* frd_size is from offset to the end of block i */
   382                  if (dist == 0) {
   383                          i++;
   384                          offset   = flat_file->indices[i];
   385                          frd_size = flat_file->blocklens[i];
   386                          break;
   387                  }
   388                  if (dist > 0) {
   389                      frd_size = dist;
   390                      break;
   391                  }
   392              }
   393              st_index = i;  /* starting index in 
flat_file->indices[] */
   394              offset += disp + 
(ADIO_Offset)n_filetypes*filetype_extent;
   395          }

I propose not to skip blocklens[i]==0
 
diff -u ad_read_coll.c.old ad_read_coll.c
--- ad_read_coll.c.old  2008-11-13 17:54:08.000000000 +0100
+++ ad_read_coll.c      2010-07-27 14:45:11.000000000 +0200
@@ -373,10 +373,9 @@
              offset     -= (ADIO_Offset)n_filetypes * filetype_extent;
                /* now offset is local to this extent */
 
-            /* find the block where offset is located, skip 
blocklens[i]==0 */
+            /* find the block where offset is located */
             for (i=0; i<flat_file->count; i++) {
                 ADIO_Offset dist;
-                if (flat_file->blocklens[i] == 0) continue;
                 dist = flat_file->indices[i] + flat_file->blocklens[i] 
- offset;
                 /* frd_size is from offset to the end of block i */
                if (dist == 0) {




More information about the mpich-discuss mailing list