aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2023-05-02 13:08:34 -0700
committerZorro Lang <zlang@kernel.org>2023-05-14 21:51:47 +0800
commitc387c694bde333fb3e1f46e09b65a7d4b5e52572 (patch)
treef3b92e7b46bf62c8a038916f8a262dc7f99f9ac7
parent715d052a8fafc049944d3e295d5b53177b184a22 (diff)
downloadxfstests-dev-c387c694bde333fb3e1f46e09b65a7d4b5e52572.tar.gz
fiemap-tester: holes can be backed by unwritten extents
Filesystem behavior is pretty open-ended for sparse ranges (i.e. holes) of a file that have not yet been written to. That space can remain unmapped, it can be mapped to written space that has been zeroed, or it can be mapped to unwritten extents. This program trips over that last condition on XFS. If the file is located on a data device with a raid stripe geometry or on a realtime device with a realtime extent size larger than 1 filesystem block, it's possible for unwritten areas to be backed by unwritten preallocations or unwritten rt blocks, respectively. Fix the test to skip unwritten extents here. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
-rw-r--r--src/fiemap-tester.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/fiemap-tester.c b/src/fiemap-tester.c
index 3db24daa79..7e9f9fe8c1 100644
--- a/src/fiemap-tester.c
+++ b/src/fiemap-tester.c
@@ -375,6 +375,13 @@ check_hole(struct fiemap *fiemap, int fd, __u64 logical_offset, int blocksize)
if (logical_offset + blocksize < start)
break;
+ /*
+ * Filesystems are allowed to fill in holes with preallocated
+ * unwritten extents
+ */
+ if (extent->fe_flags & FIEMAP_EXTENT_UNWRITTEN)
+ continue;
+
if (logical_offset >= start &&
logical_offset < end) {