mirror of
https://github.com/torvalds/linux.git
synced 2024-11-29 15:41:36 +00:00
xfs: simplify returns in xchk_bmap
Remove the pointless goto and return code in xchk_bmap, since it only serves to obscure what's going on in the function. Instead, return whichever error code is appropriate there. For nonexistent forks, this should have been ENOENT. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
parent
369c001b7a
commit
65092ca140
@ -841,7 +841,7 @@ xchk_bmap(
|
||||
|
||||
/* Non-existent forks can be ignored. */
|
||||
if (!ifp)
|
||||
goto out;
|
||||
return -ENOENT;
|
||||
|
||||
info.is_rt = whichfork == XFS_DATA_FORK && XFS_IS_REALTIME_INODE(ip);
|
||||
info.whichfork = whichfork;
|
||||
@ -853,7 +853,7 @@ xchk_bmap(
|
||||
/* No CoW forks on non-reflink inodes/filesystems. */
|
||||
if (!xfs_is_reflink_inode(ip)) {
|
||||
xchk_ino_set_corrupt(sc, sc->ip->i_ino);
|
||||
goto out;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case XFS_ATTR_FORK:
|
||||
@ -873,31 +873,31 @@ xchk_bmap(
|
||||
/* No mappings to check. */
|
||||
if (whichfork == XFS_COW_FORK)
|
||||
xchk_fblock_set_corrupt(sc, whichfork, 0);
|
||||
goto out;
|
||||
return 0;
|
||||
case XFS_DINODE_FMT_EXTENTS:
|
||||
break;
|
||||
case XFS_DINODE_FMT_BTREE:
|
||||
if (whichfork == XFS_COW_FORK) {
|
||||
xchk_fblock_set_corrupt(sc, whichfork, 0);
|
||||
goto out;
|
||||
return 0;
|
||||
}
|
||||
|
||||
error = xchk_bmap_btree(sc, whichfork, &info);
|
||||
if (error)
|
||||
goto out;
|
||||
return error;
|
||||
break;
|
||||
default:
|
||||
xchk_fblock_set_corrupt(sc, whichfork, 0);
|
||||
goto out;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
|
||||
goto out;
|
||||
return 0;
|
||||
|
||||
/* Find the offset of the last extent in the mapping. */
|
||||
error = xfs_bmap_last_offset(ip, &endoff, whichfork);
|
||||
if (!xchk_fblock_process_error(sc, whichfork, 0, &error))
|
||||
goto out;
|
||||
return error;
|
||||
|
||||
/*
|
||||
* Scrub extent records. We use a special iterator function here that
|
||||
@ -910,12 +910,12 @@ xchk_bmap(
|
||||
while (xchk_bmap_iext_iter(&info, &irec)) {
|
||||
if (xchk_should_terminate(sc, &error) ||
|
||||
(sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT))
|
||||
goto out;
|
||||
return 0;
|
||||
|
||||
if (irec.br_startoff >= endoff) {
|
||||
xchk_fblock_set_corrupt(sc, whichfork,
|
||||
irec.br_startoff);
|
||||
goto out;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (isnullstartblock(irec.br_startblock))
|
||||
@ -928,10 +928,10 @@ xchk_bmap(
|
||||
if (xchk_bmap_want_check_rmaps(&info)) {
|
||||
error = xchk_bmap_check_rmaps(sc, whichfork);
|
||||
if (!xchk_fblock_xref_process_error(sc, whichfork, 0, &error))
|
||||
goto out;
|
||||
return error;
|
||||
}
|
||||
out:
|
||||
return error;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Scrub an inode's data fork. */
|
||||
|
Loading…
Reference in New Issue
Block a user