@@ -1909,14 +1909,32 @@ static int logfs_replay_write(void *data, ADIO_Offset writeofs, int size, ADIO_O
19091909 ftypecount = size / rep -> ftype_size ;
19101910 ftyperemainder = size % rep -> ftype_size ;
19111911
1912- /* we have a flatbuf rep */
1913- for (i = 0 ; i < ftypecount ; ++ i ) {
1914- for (j = 0 ; j < rep -> ftype -> count ; ++ j ) {
1915- fileofs = ofs + i * rep -> ftype_extent + rep -> ftype -> indices [j ] - rep -> ftype -> indices [0 ];
1916-
1917- logfs_rtree_addsplit (rep -> tree ,
1918- fileofs , fileofs + rep -> ftype -> blocklens [j ], datalogstart );
19191912
1913+ /* we have a flatbuf rep */
1914+ /* MPI-IO file views can be tiled */
1915+ for (i = 0 ; i < ftypecount ; ++ i )
1916+ {
1917+ /* examine each element of the flattened representation */
1918+ for (j = 0 ; j < rep -> ftype -> count ; ++ j )
1919+ {
1920+ /* fileofs: offset in canonical file. Computation was wrong for
1921+ * cases where datatype lower bound was non-zero:
1922+ * - ofs: user-provided offset of this request. we got that value
1923+ * directly from the .meta log file
1924+ * - i*rep->ftype_extent: the idiomantic way to deal with tiled file
1925+ * views
1926+ * - rep->ftype->indices[j] - rep->ftype->indices[0]: When
1927+ * indices[0] is zero (when lower bound is zero), this does nothing.
1928+ * When lower bound is non-zero this adjusts the offsets relative to
1929+ * the lower bound. However the offsets do not need adjusting! */
1930+
1931+ fileofs = ofs + i * rep -> ftype_extent +
1932+ rep -> ftype -> indices [j ];
1933+
1934+ logfs_rtree_addsplit (rep -> tree ,
1935+ fileofs , fileofs + rep -> ftype -> blocklens [j ], datalogstart );
1936+
1937+ /* datalogstart: posistion in .data file */
19201938 datalogstart += rep -> ftype -> blocklens [j ];
19211939 }
19221940 }
0 commit comments