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 committed Sep 25, 2021
1 parent 568bb49 commit ff6761a
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 @@ -1251,7 +1251,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 ff6761a

Please sign in to comment.