Skip to content

Commit

Permalink
Merge pull request #13025 from edgargabriel/pr/seek-end-fix-v4.1.x
Browse files Browse the repository at this point in the history
io/ompio: file file_seek calculation - v4.1.x
bwbarrett authored Jan 13, 2025
2 parents 31f6f4d + 5afde40 commit 1176ac1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ompi/mca/io/ompio/io_ompio_file_open.c
Original file line number Diff line number Diff line change
@@ -402,19 +402,21 @@ static void mca_io_ompio_file_get_eof_offset (ompio_file_t *fh,
in_offset -= fh->f_disp;
if ( fh->f_view_size > 0 ) {
/* starting offset of the current copy of the filew view */
start_offset = in_offset / fh->f_view_extent;
start_offset = (in_offset / fh->f_view_extent) * fh->f_view_extent;

index_in_file_view = 0;
/* determine block id that the offset is located in and
the starting offset of that block */
while ( offset <= in_offset && index_in_file_view < fh->f_iov_count) {
prev_offset = offset;
while (offset <= in_offset && index_in_file_view < fh->f_iov_count) {
offset = start_offset + (OMPI_MPI_OFFSET_TYPE)(intptr_t) fh->f_decoded_iov[index_in_file_view++].iov_base;
if (offset <= in_offset) {
prev_offset = offset;
}
}

offset = prev_offset;
blocklen = fh->f_decoded_iov[index_in_file_view-1].iov_len;
while ( offset <= in_offset && k <= blocklen ) {
while (offset <= in_offset && k <= blocklen) {
prev_offset = offset;
offset += fh->f_etype_size;
k += fh->f_etype_size;

0 comments on commit 1176ac1

Please sign in to comment.