Skip to content

Commit 65092ca

Browse files
author
Darrick J. Wong
committed
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>
1 parent 369c001 commit 65092ca

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

fs/xfs/scrub/bmap.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ xchk_bmap(
841841

842842
/* Non-existent forks can be ignored. */
843843
if (!ifp)
844-
goto out;
844+
return -ENOENT;
845845

846846
info.is_rt = whichfork == XFS_DATA_FORK && XFS_IS_REALTIME_INODE(ip);
847847
info.whichfork = whichfork;
@@ -853,7 +853,7 @@ xchk_bmap(
853853
/* No CoW forks on non-reflink inodes/filesystems. */
854854
if (!xfs_is_reflink_inode(ip)) {
855855
xchk_ino_set_corrupt(sc, sc->ip->i_ino);
856-
goto out;
856+
return 0;
857857
}
858858
break;
859859
case XFS_ATTR_FORK:
@@ -873,31 +873,31 @@ xchk_bmap(
873873
/* No mappings to check. */
874874
if (whichfork == XFS_COW_FORK)
875875
xchk_fblock_set_corrupt(sc, whichfork, 0);
876-
goto out;
876+
return 0;
877877
case XFS_DINODE_FMT_EXTENTS:
878878
break;
879879
case XFS_DINODE_FMT_BTREE:
880880
if (whichfork == XFS_COW_FORK) {
881881
xchk_fblock_set_corrupt(sc, whichfork, 0);
882-
goto out;
882+
return 0;
883883
}
884884

885885
error = xchk_bmap_btree(sc, whichfork, &info);
886886
if (error)
887-
goto out;
887+
return error;
888888
break;
889889
default:
890890
xchk_fblock_set_corrupt(sc, whichfork, 0);
891-
goto out;
891+
return 0;
892892
}
893893

894894
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
895-
goto out;
895+
return 0;
896896

897897
/* Find the offset of the last extent in the mapping. */
898898
error = xfs_bmap_last_offset(ip, &endoff, whichfork);
899899
if (!xchk_fblock_process_error(sc, whichfork, 0, &error))
900-
goto out;
900+
return error;
901901

902902
/*
903903
* Scrub extent records. We use a special iterator function here that
@@ -910,12 +910,12 @@ xchk_bmap(
910910
while (xchk_bmap_iext_iter(&info, &irec)) {
911911
if (xchk_should_terminate(sc, &error) ||
912912
(sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT))
913-
goto out;
913+
return 0;
914914

915915
if (irec.br_startoff >= endoff) {
916916
xchk_fblock_set_corrupt(sc, whichfork,
917917
irec.br_startoff);
918-
goto out;
918+
return 0;
919919
}
920920

921921
if (isnullstartblock(irec.br_startblock))
@@ -928,10 +928,10 @@ xchk_bmap(
928928
if (xchk_bmap_want_check_rmaps(&info)) {
929929
error = xchk_bmap_check_rmaps(sc, whichfork);
930930
if (!xchk_fblock_xref_process_error(sc, whichfork, 0, &error))
931-
goto out;
931+
return error;
932932
}
933-
out:
934-
return error;
933+
934+
return 0;
935935
}
936936

937937
/* Scrub an inode's data fork. */

0 commit comments

Comments
 (0)