Skip to content

Commit

Permalink
utils: rm_offset_get_from_fd: Set file_offset based on extent start
Browse files Browse the repository at this point in the history
Holes are represented by logical gaps in the FIEMAP mapping. Summing the
extent lengths to get a file offset causes file_offset to get out of
sync. If the hole is smaller than the following extent, the next few
FIEMAP calls may return the same extent.

Fixes sahib#529
  • Loading branch information
cebtenzzre authored and intelfx committed Mar 9, 2023
1 parent 96e696c commit a19d592
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/utilities.c
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ RmOff rm_offset_get_from_fd(int fd, RmOff file_offset, RmOff *file_offset_next,
}

/* move offsets in preparation for reading next extent */
file_offset += fm_ext.fe_length;
file_offset = fm_ext.fe_logical + fm_ext.fe_length;
expected = fm_ext.fe_physical + fm_ext.fe_length;
}

Expand Down

0 comments on commit a19d592

Please sign in to comment.