Commit 6cee51e6 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: clean up xattr scrub initialization

Clean up local variable initialization and error returns in xchk_xattr.
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent ae0506eb
...@@ -560,7 +560,16 @@ int ...@@ -560,7 +560,16 @@ int
xchk_xattr( xchk_xattr(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
struct xchk_xattr sx; struct xchk_xattr sx = {
.sc = sc,
.context = {
.dp = sc->ip,
.tp = sc->tp,
.resynch = 1,
.put_listent = xchk_xattr_listent,
.allow_incomplete = true,
},
};
xfs_dablk_t last_checked = -1U; xfs_dablk_t last_checked = -1U;
int error = 0; int error = 0;
...@@ -581,22 +590,13 @@ xchk_xattr( ...@@ -581,22 +590,13 @@ xchk_xattr(
error = xchk_da_btree(sc, XFS_ATTR_FORK, xchk_xattr_rec, error = xchk_da_btree(sc, XFS_ATTR_FORK, xchk_xattr_rec,
&last_checked); &last_checked);
if (error) if (error)
goto out; return error;
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
goto out; return 0;
/* Check that every attr key can also be looked up by hash. */
memset(&sx, 0, sizeof(sx));
sx.context.dp = sc->ip;
sx.context.resynch = 1;
sx.context.put_listent = xchk_xattr_listent;
sx.context.tp = sc->tp;
sx.context.allow_incomplete = true;
sx.sc = sc;
/* /*
* Look up every xattr in this file by name. * Look up every xattr in this file by name and hash.
* *
* Use the backend implementation of xfs_attr_list to call * Use the backend implementation of xfs_attr_list to call
* xchk_xattr_listent on every attribute key in this inode. * xchk_xattr_listent on every attribute key in this inode.
...@@ -613,11 +613,11 @@ xchk_xattr( ...@@ -613,11 +613,11 @@ xchk_xattr(
*/ */
error = xfs_attr_list_ilocked(&sx.context); error = xfs_attr_list_ilocked(&sx.context);
if (!xchk_fblock_process_error(sc, XFS_ATTR_FORK, 0, &error)) if (!xchk_fblock_process_error(sc, XFS_ATTR_FORK, 0, &error))
goto out; return error;
/* Did our listent function try to return any errors? */ /* Did our listent function try to return any errors? */
if (sx.context.seen_enough < 0) if (sx.context.seen_enough < 0)
error = sx.context.seen_enough; return sx.context.seen_enough;
out:
return error; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment