From: Darrick J. Wong Date: Mon, 15 Apr 2024 23:07:50 +0000 (-0700) Subject: xfs_repair: don't create block maps for data files X-Git-Tag: v6.8.0~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=585a1f78971bd0559fb51505eddc4f67f3bcb49d;p=thirdparty%2Fxfsprogs-dev.git xfs_repair: don't create block maps for data files 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 Reviewed-by: Christoph Hellwig --- diff --git a/repair/dinode.c b/repair/dinode.c index bf93a579..94f5fdcb 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -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;