Skip to content

Commit 6cee51e

Browse files
author
Darrick J. Wong
committed
xfs: clean up xattr scrub initialization
Clean up local variable initialization and error returns in xchk_xattr. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com>
1 parent ae0506e commit 6cee51e

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

fs/xfs/scrub/attr.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,16 @@ int
560560
xchk_xattr(
561561
struct xfs_scrub *sc)
562562
{
563-
struct xchk_xattr sx;
563+
struct xchk_xattr sx = {
564+
.sc = sc,
565+
.context = {
566+
.dp = sc->ip,
567+
.tp = sc->tp,
568+
.resynch = 1,
569+
.put_listent = xchk_xattr_listent,
570+
.allow_incomplete = true,
571+
},
572+
};
564573
xfs_dablk_t last_checked = -1U;
565574
int error = 0;
566575

@@ -581,22 +590,13 @@ xchk_xattr(
581590
error = xchk_da_btree(sc, XFS_ATTR_FORK, xchk_xattr_rec,
582591
&last_checked);
583592
if (error)
584-
goto out;
593+
return error;
585594

586595
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
587-
goto out;
588-
589-
/* Check that every attr key can also be looked up by hash. */
590-
memset(&sx, 0, sizeof(sx));
591-
sx.context.dp = sc->ip;
592-
sx.context.resynch = 1;
593-
sx.context.put_listent = xchk_xattr_listent;
594-
sx.context.tp = sc->tp;
595-
sx.context.allow_incomplete = true;
596-
sx.sc = sc;
596+
return 0;
597597

598598
/*
599-
* Look up every xattr in this file by name.
599+
* Look up every xattr in this file by name and hash.
600600
*
601601
* Use the backend implementation of xfs_attr_list to call
602602
* xchk_xattr_listent on every attribute key in this inode.
@@ -613,11 +613,11 @@ xchk_xattr(
613613
*/
614614
error = xfs_attr_list_ilocked(&sx.context);
615615
if (!xchk_fblock_process_error(sc, XFS_ATTR_FORK, 0, &error))
616-
goto out;
616+
return error;
617617

618618
/* Did our listent function try to return any errors? */
619619
if (sx.context.seen_enough < 0)
620-
error = sx.context.seen_enough;
621-
out:
622-
return error;
620+
return sx.context.seen_enough;
621+
622+
return 0;
623623
}

0 commit comments

Comments
 (0)