If the fiemap call returns fewer extents than asked for,
the fiemap tester gets confused. If this happens, advance,
and call fiemap again for the next offset.
XFS exposed this because if a file is all-delalloc, it was
only returning 1 mapped extent (this is probably also a buglet).
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
for (i = cur_extent, c = 1; i < blocks; i++, c++) {
__u64 logical_offset = i * blocksize;
- if (c > blocks_to_map)
+ if (c > fiemap->fm_mapped_extents) {
+ i++;
break;
+ }
switch (map[i]) {
case 'D':