diff mbox

[06/16] xfs_scrub: don't try to scan xattrs if bstat says there aren't any

Message ID 151993161291.22223.12229177976202068960.stgit@magnolia (mailing list archive)
State Accepted
Headers show

Commit Message

Darrick J. Wong March 1, 2018, 7:13 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

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.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 scrub/phase5.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Eric Sandeen March 6, 2018, 5:19 p.m. UTC | #1
On 3/1/18 1:13 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> 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.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  scrub/phase5.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> 
> diff --git a/scrub/phase5.c b/scrub/phase5.c
> index 0ef6339..8e0a1be 100644
> --- a/scrub/phase5.c
> +++ b/scrub/phase5.c
> @@ -256,9 +256,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)) {
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scrub/phase5.c b/scrub/phase5.c
index 0ef6339..8e0a1be 100644
--- a/scrub/phase5.c
+++ b/scrub/phase5.c
@@ -256,9 +256,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)) {