]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: trivial xfs_btree_del_cursor cleanups
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 5 Oct 2018 02:36:09 +0000 (21:36 -0500)
committerEric Sandeen <sandeen@redhat.com>
Fri, 5 Oct 2018 02:36:09 +0000 (21:36 -0500)
Source kernel commit: 0b04b6b875b32f2b32263ba46d54d001e05724f9

The error argument to xfs_btree_del_cursor already understands the
"nonzero for error" semantics, so remove pointless error testing in the
callers and pass it directly.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_bmap.c
libxfs/xfs_bmap_btree.c
libxfs/xfs_ialloc.c
libxfs/xfs_ialloc_btree.c
libxfs/xfs_refcount.c
libxfs/xfs_rmap.c

index d2c6e58b3142eef35412539dc4fd02ae735d6a13..36f513ec8537111a9a1e91cf19c770a3f78c52e1 100644 (file)
@@ -952,8 +952,7 @@ xfs_bmap_add_attrfork_extents(
                                          XFS_DATA_FORK);
        if (cur) {
                cur->bc_private.b.allocated = 0;
-               xfs_btree_del_cursor(cur,
-                       error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
+               xfs_btree_del_cursor(cur, error);
        }
        return error;
 }
@@ -4438,8 +4437,7 @@ error0:
                xfs_trans_log_inode(tp, ip, bma.logflags);
 
        if (bma.cur) {
-               xfs_btree_del_cursor(bma.cur,
-                       error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
+               xfs_btree_del_cursor(bma.cur, error);
        }
        if (!error)
                xfs_bmap_validate_ret(orig_bno, orig_len, orig_flags, orig_mval,
@@ -4533,10 +4531,8 @@ error0:
 
        if (logflags)
                xfs_trans_log_inode(tp, ip, logflags);
-       if (cur) {
-               xfs_btree_del_cursor(cur,
-                               error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
-       }
+       if (cur)
+               xfs_btree_del_cursor(cur, error);
        return error;
 }
 
@@ -5430,8 +5426,7 @@ error0:
        if (cur) {
                if (!error)
                        cur->bc_private.b.allocated = 0;
-               xfs_btree_del_cursor(cur,
-                       error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
+               xfs_btree_del_cursor(cur, error);
        }
        return error;
 }
@@ -5691,8 +5686,7 @@ done:
        *next_fsb = got.br_startoff;
 del_cursor:
        if (cur)
-               xfs_btree_del_cursor(cur,
-                       error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
+               xfs_btree_del_cursor(cur, error);
        if (logflags)
                xfs_trans_log_inode(tp, ip, logflags);
        return error;
@@ -5819,8 +5813,7 @@ xfs_bmap_insert_extents(
        *next_fsb = got.br_startoff;
 del_cursor:
        if (cur)
-               xfs_btree_del_cursor(cur,
-                       error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
+               xfs_btree_del_cursor(cur, error);
        if (logflags)
                xfs_trans_log_inode(tp, ip, logflags);
        return error;
@@ -5936,8 +5929,7 @@ xfs_bmap_split_extent_at(
 del_cursor:
        if (cur) {
                cur->bc_private.b.allocated = 0;
-               xfs_btree_del_cursor(cur,
-                               error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
+               xfs_btree_del_cursor(cur, error);
        }
 
        if (logflags)
index 626341ec46dc5ea04f6b881149a21de2b67a0174..4c513d0e333a062b6c93846ae5d09c021e07aeb5 100644 (file)
@@ -636,7 +636,7 @@ xfs_bmbt_change_owner(
        cur->bc_private.b.flags |= XFS_BTCUR_BPRV_INVALID_OWNER;
 
        error = xfs_btree_change_owner(cur, new_owner, buffer_list);
-       xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
+       xfs_btree_del_cursor(cur, error);
        return error;
 }
 
index c31bbdcc25c5337f9eaddd508a2f77e86b9bb7ec..3095f3735c6654d63cfdbc0f85a8494f8869037a 100644 (file)
@@ -2252,7 +2252,7 @@ xfs_imap_lookup(
        }
 
        xfs_trans_brelse(tp, agbp);
-       xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
+       xfs_btree_del_cursor(cur, error);
        if (error)
                return error;
 
index b2f48fcaf2c1368cbc4f577832886252a5eaa71b..f38170a3d0d9d9d4ae8db426f92f35339f2a4c3f 100644 (file)
@@ -565,7 +565,7 @@ xfs_inobt_count_blocks(
 
        cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno, btnum);
        error = xfs_btree_count_blocks(cur, tree_blocks);
-       xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
+       xfs_btree_del_cursor(cur, error);
        xfs_buf_relse(agbp);
 
        return error;
index b21003e15ca0aebc17ed4318b1c3382e57764df8..fabbacd46ca7d74d00b6c0216c3b6f52f878fbe4 100644 (file)
@@ -1066,7 +1066,7 @@ xfs_refcount_finish_one_cleanup(
        if (rcur == NULL)
                return;
        agbp = rcur->bc_private.a.agbp;
-       xfs_btree_del_cursor(rcur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
+       xfs_btree_del_cursor(rcur, error);
        if (error)
                xfs_trans_brelse(tp, agbp);
 }
index 8e5f86d57ce3817d55f37ecca9fa6193177d64f7..50f6043e9236fcee014049663c6e7eced90c8199 100644 (file)
@@ -668,14 +668,8 @@ xfs_rmap_free(
        cur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno);
 
        error = xfs_rmap_unmap(cur, bno, len, false, oinfo);
-       if (error)
-               goto out_error;
 
-       xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
-       return 0;
-
-out_error:
-       xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
+       xfs_btree_del_cursor(cur, error);
        return error;
 }
 
@@ -910,14 +904,8 @@ xfs_rmap_alloc(
 
        cur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno);
        error = xfs_rmap_map(cur, bno, len, false, oinfo);
-       if (error)
-               goto out_error;
 
-       xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
-       return 0;
-
-out_error:
-       xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
+       xfs_btree_del_cursor(cur, error);
        return error;
 }
 
@@ -2154,7 +2142,7 @@ xfs_rmap_finish_one_cleanup(
        if (rcur == NULL)
                return;
        agbp = rcur->bc_private.a.agbp;
-       xfs_btree_del_cursor(rcur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
+       xfs_btree_del_cursor(rcur, error);
        if (error)
                xfs_trans_brelse(tp, agbp);
 }