[Top] [All Lists]

[PATCH 1/2] xfstests: fix fiemap-tester for fewer extents returned

To: xfs mailing list <xfs@xxxxxxxxxxx>
Subject: [PATCH 1/2] xfstests: fix fiemap-tester for fewer extents returned
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Thu, 24 Feb 2011 16:02:06 -0600
Cc: Josef Bacik <jbacik@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc13 Lightning/1.0b3pre Thunderbird/3.1.7
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@xxxxxxxxxx>

diff --git a/src/fiemap-tester.c b/src/fiemap-tester.c
index f6875af..53d7a64 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 
                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++;
+                       }
                        switch (map[i]) {
                        case 'D':

<Prev in Thread] Current Thread [Next in Thread>