xfs: don't load local xattr values during scrub
authorDarrick J. Wong <djwong@kernel.org>
Wed, 12 Apr 2023 02:00:35 +0000 (19:00 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 12 Apr 2023 02:00:35 +0000 (19:00 -0700)
Local extended attributes store their values within the same leaf block.
There's no header for the values themselves, nor are they separately
checksummed.  Hence we can save a bit of time in the attr scrubber by
not wasting time retrieving the values.

Regrettably, shortform attributes do not set XFS_ATTR_LOCAL so this
offers us no advantage there, but at least there are very few attrs in
that case.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/scrub/attr.c

index 2445fe2..6c16d95 100644 (file)
@@ -201,6 +201,14 @@ xchk_xattr_listent(
        }
 
        /*
+        * Local xattr values are stored in the attr leaf block, so we don't
+        * need to retrieve the value from a remote block to detect corruption
+        * problems.
+        */
+       if (flags & XFS_ATTR_LOCAL)
+               goto fail_xref;
+
+       /*
         * Try to allocate enough memory to extrat the attr value.  If that
         * doesn't work, we overload the seen_enough variable to convey
         * the error message back to the main scrub function.