summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2023-05-02 13:08:40 -0700
committerZorro Lang <zlang@kernel.org>2023-05-14 21:52:09 +0800
commit6a0bba58d043040cf2d1f5430e0aeb52f5747ccd (patch)
tree6733a9a5ec18d5db596062e28200d8b1322c3af9
parentc387c694bde333fb3e1f46e09b65a7d4b5e52572 (diff)
fiemap: FIEMAP_EXTENT_LAST denotes the last record in the recordset
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>
-rw-r--r--src/fiemap-tester.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/fiemap-tester.c b/src/fiemap-tester.c
index 7e9f9fe8..fa085a25 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: