]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
fiemap: FIEMAP_EXTENT_LAST denotes the last record in the recordset
authorDarrick J. Wong <djwong@kernel.org>
Tue, 2 May 2023 20:08:40 +0000 (13:08 -0700)
committerZorro Lang <zlang@kernel.org>
Sun, 14 May 2023 13:52:09 +0000 (21:52 +0800)
Remove this check because FIEMAP_EXTENT_LAST denotes the last space
mapping record in the recordset of space mappings attached to the file.
That last mapping might actually map space beyond EOF, in the case of
(a) speculative post-eof preallocations, (b) stripe-aligned allocations
on XFS, or (c) realtime files in XFS.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
src/fiemap-tester.c

index 7e9f9fe8c12b24c2395162292a11df099cd55831..fa085a25f1c4fe9d8dae18d762edba19295bac19 100644 (file)
@@ -236,7 +236,7 @@ check_flags(struct fiemap *fiemap, int blocksize)
 
 static int
 check_data(struct fiemap *fiemap, __u64 logical_offset, int blocksize,
-          int last, int prealloc)
+          int prealloc)
 {
        struct fiemap_extent *extent;
        __u64 orig_offset = logical_offset;
@@ -280,11 +280,6 @@ check_data(struct fiemap *fiemap, __u64 logical_offset, int blocksize,
        if (!found) {
                printf("ERROR: couldn't find extent at %llu\n",
                       (unsigned long long)(orig_offset / blocksize));
-       } else if (last &&
-                  !(fiemap->fm_extents[c].fe_flags & FIEMAP_EXTENT_LAST)) {
-               printf("ERROR: last extent not marked as last: %llu\n",
-                      (unsigned long long)(orig_offset / blocksize));
-               found = 0;
        }
 
        return (!found) ? -1 : 0;
@@ -418,7 +413,7 @@ compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize, int syncfil
 {
        struct fiemap *fiemap;
        char *fiebuf;
-       int blocks_to_map, ret, cur_extent = 0, last_data = 0;
+       int blocks_to_map, ret, cur_extent = 0;
        __u64 map_start, map_length;
        int i, c;
 
@@ -437,11 +432,6 @@ compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize, int syncfil
        map_start = 0;
        map_length = blocks_to_map * blocksize;
 
-       for (i = 0; i < blocks; i++) {
-               if (map[i] != 'H')
-                       last_data = i;
-       }
-
        fiemap->fm_flags = syncfile ? FIEMAP_FLAG_SYNC : 0;
        fiemap->fm_extent_count = blocks_to_map;
        fiemap->fm_mapped_extents = 0;
@@ -471,7 +461,7 @@ compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize, int syncfil
                        switch (map[i]) {
                        case 'D':
                                if (check_data(fiemap, logical_offset,
-                                              blocksize, last_data == i, 0))
+                                              blocksize, 0))
                                        goto error;
                                break;
                        case 'H':
@@ -481,7 +471,7 @@ compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize, int syncfil
                                break;
                        case 'P':
                                if (check_data(fiemap, logical_offset,
-                                              blocksize, last_data == i, 1))
+                                              blocksize, 1))
                                        goto error;
                                break;
                        default: