Skip to contentSkip to conversation

xfs_scrub: don't try to scan xattrs if bstat says there aren't any

PATCH New Darrick J. Wong 1 participant 1 message Feb 22, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs_scrub: don't try to scan xattrs if bstat says there aren't any

From: Darrick J. Wong <[email protected]>

Only try to scan the extended attributes of a file if bstat says that the file actually has any. Surprisingly, this reduces the phase 5 runtime by 40% if most of the files don't have attrs.

---
 scrub/phase5.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
scrub/phase5.c +6 -3
index 703b279..aafa036 100644
@@ -259,9 +259,12 @@ xfs_scrub_connections(
 	background_sleep();
 
 	/* Warn about naming problems in xattrs. */
-	moveon = xfs_scrub_scan_fhandle_xattrs(ctx, descr, handle, bstat);
-	if (!moveon)
-		goto out;
+	if (bstat->bs_xflags & FS_XFLAG_HASATTR) {
+		moveon = xfs_scrub_scan_fhandle_xattrs(ctx, descr, handle,
+				bstat);
+		if (!moveon)
+			goto out;
+	}
 
 	/* Open the dir, let the kernel try to reconnect it to the root. */
 	if (S_ISDIR(bstat->bs_mode)) {