[PATCH 5/7] fiemap-tester: holes can be backed by unwritten extents

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <djwong@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 src/fiemap-tester.c |    7 +++++++
 1 file changed, 7 insertions(+)


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) {
 




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux