[PATCH 6/7] fiemap: FIEMAP_EXTENT_LAST denotes the last record in the recordset

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

 



From: Darrick J. Wong <djwong@xxxxxxxxxx>

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


diff --git a/src/fiemap-tester.c b/src/fiemap-tester.c
index 7e9f9fe8c1..fa085a25f1 100644
--- a/src/fiemap-tester.c
+++ b/src/fiemap-tester.c
@@ -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:




[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