xfs: move all scrub input checking to xfs_scrub_validate
There were ad-hoc checks for some scrub types but not others; mark each scrub type with ... it's type, and use that to validate the allowed and/or required input fields. Moving these checks out of xfs_scrub_setup_ag_header makes it a thin wrapper, so unwrap it in the process. Signed-off-by: Eric Sandeen <sandeen@redhat.com> [darrick: add xfs_ prefix to enum, check scrub args after checking type] Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:

committed by
Darrick J. Wong

parent
0a085ddf0e
commit
8e63083762
@@ -472,7 +472,7 @@ xfs_scrub_setup_ag_btree(
|
||||
return error;
|
||||
}
|
||||
|
||||
error = xfs_scrub_setup_ag_header(sc, ip);
|
||||
error = xfs_scrub_setup_fs(sc, ip);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
@@ -507,14 +507,6 @@ xfs_scrub_get_inode(
|
||||
struct xfs_inode *ip = NULL;
|
||||
int error;
|
||||
|
||||
/*
|
||||
* If userspace passed us an AG number or a generation number
|
||||
* without an inode number, they haven't got a clue so bail out
|
||||
* immediately.
|
||||
*/
|
||||
if (sc->sm->sm_agno || (sc->sm->sm_gen && !sc->sm->sm_ino))
|
||||
return -EINVAL;
|
||||
|
||||
/* We want to scan the inode we already had opened. */
|
||||
if (sc->sm->sm_ino == 0 || sc->sm->sm_ino == ip_in->i_ino) {
|
||||
sc->ip = ip_in;
|
||||
|
Reference in New Issue
Block a user