Commit 2c3b83d7 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: attribute scrub should use seen_enough to pass error values

When we're iterating all the attributes using the built-in xattr
iterator, we can use the seen_enough variable to pass error codes back
to the main scrub function instead of flattening them into 0/1.  This
will be used in a more exciting fashion in upcoming patches.
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
parent bf3cb394
...@@ -112,7 +112,13 @@ typedef struct xfs_attr_list_context { ...@@ -112,7 +112,13 @@ typedef struct xfs_attr_list_context {
struct xfs_inode *dp; /* inode */ struct xfs_inode *dp; /* inode */
struct attrlist_cursor_kern *cursor; /* position in list */ struct attrlist_cursor_kern *cursor; /* position in list */
char *alist; /* output buffer */ char *alist; /* output buffer */
int seen_enough; /* T/F: seen enough of list? */
/*
* Abort attribute list iteration if non-zero. Can be used to pass
* error values to the xfs_attr_list caller.
*/
int seen_enough;
ssize_t count; /* num used entries */ ssize_t count; /* num used entries */
int dupcnt; /* count dup hashvals seen */ int dupcnt; /* count dup hashvals seen */
int bufsize; /* total buffer size */ int bufsize; /* total buffer size */
......
...@@ -73,7 +73,7 @@ xchk_xattr_listent( ...@@ -73,7 +73,7 @@ xchk_xattr_listent(
sx = container_of(context, struct xchk_xattr, context); sx = container_of(context, struct xchk_xattr, context);
if (xchk_should_terminate(sx->sc, &error)) { if (xchk_should_terminate(sx->sc, &error)) {
context->seen_enough = 1; context->seen_enough = error;
return; return;
} }
...@@ -115,7 +115,7 @@ xchk_xattr_listent( ...@@ -115,7 +115,7 @@ xchk_xattr_listent(
args.blkno); args.blkno);
fail_xref: fail_xref:
if (sx->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) if (sx->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
context->seen_enough = 1; context->seen_enough = XFS_ITER_ABORT;
return; return;
} }
...@@ -454,6 +454,10 @@ xchk_xattr( ...@@ -454,6 +454,10 @@ xchk_xattr(
error = xfs_attr_list_int_ilocked(&sx.context); error = xfs_attr_list_int_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; goto out;
/* Did our listent function try to return any errors? */
if (sx.context.seen_enough < 0)
error = sx.context.seen_enough;
out: out:
return error; return error;
} }
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