From e423b5c584300c738cee95badc13b01bf38c5dc8 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Tue, 8 Mar 2011 09:09:38 -0600 Subject: [PATCH] Fix fiemap-tester for fewer extents returned 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 Reviewed-by: Alex Elder --- src/fiemap-tester.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fiemap-tester.c b/src/fiemap-tester.c index f6875af3..53d7a640 100644 --- a/src/fiemap-tester.c +++ b/src/fiemap-tester.c @@ -467,8 +467,10 @@ compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize) 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': -- 2.47.3