]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: don't create block maps for data files
authorDarrick J. Wong <djwong@kernel.org>
Mon, 15 Apr 2024 23:07:50 +0000 (16:07 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 17 Apr 2024 21:06:28 +0000 (14:06 -0700)
Repair only queries inode block maps for inode forks that map filesystem
metadata.  IOWs, it only uses it for directories, quota files, symlinks,
and realtime space metadata.  It doesn't use it for regular files or
realtime files, so exclude its use for these files to reduce processing
times for heavily fragmented regular files.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
repair/dinode.c

index bf93a5790877a1eb0a5c948df2ab55365ff8cdfb..94f5fdcb4a3758e89f60c553169393cf457b6b62 100644 (file)
@@ -1930,8 +1930,14 @@ retry:
        if (*nextents > be64_to_cpu(dino->di_nblocks))
                *nextents = 1;
 
-
-       if (dino->di_format != XFS_DINODE_FMT_LOCAL && type != XR_INO_RTDATA)
+       /*
+        * Repair doesn't care about the block maps for regular file data
+        * because it never tries to read data blocks.  Only spend time on
+        * constructing a block map for directories, quota files, symlinks,
+        * and realtime space metadata.
+        */
+       if (dino->di_format != XFS_DINODE_FMT_LOCAL &&
+           (type != XR_INO_RTDATA && type != XR_INO_DATA))
                *dblkmap = blkmap_alloc(*nextents, XFS_DATA_FORK);
        *nextents = 0;