mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
xfs: trivial xfs_btree_del_cursor cleanups
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>
This commit is contained in:
parent
81b549aa62
commit
0b04b6b875
@ -961,8 +961,7 @@ xfs_bmap_add_attrfork_extents(
|
|||||||
XFS_DATA_FORK);
|
XFS_DATA_FORK);
|
||||||
if (cur) {
|
if (cur) {
|
||||||
cur->bc_private.b.allocated = 0;
|
cur->bc_private.b.allocated = 0;
|
||||||
xfs_btree_del_cursor(cur,
|
xfs_btree_del_cursor(cur, error);
|
||||||
error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
|
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
@ -4447,8 +4446,7 @@ error0:
|
|||||||
xfs_trans_log_inode(tp, ip, bma.logflags);
|
xfs_trans_log_inode(tp, ip, bma.logflags);
|
||||||
|
|
||||||
if (bma.cur) {
|
if (bma.cur) {
|
||||||
xfs_btree_del_cursor(bma.cur,
|
xfs_btree_del_cursor(bma.cur, error);
|
||||||
error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
|
|
||||||
}
|
}
|
||||||
if (!error)
|
if (!error)
|
||||||
xfs_bmap_validate_ret(orig_bno, orig_len, orig_flags, orig_mval,
|
xfs_bmap_validate_ret(orig_bno, orig_len, orig_flags, orig_mval,
|
||||||
@ -4542,10 +4540,8 @@ error0:
|
|||||||
|
|
||||||
if (logflags)
|
if (logflags)
|
||||||
xfs_trans_log_inode(tp, ip, logflags);
|
xfs_trans_log_inode(tp, ip, logflags);
|
||||||
if (cur) {
|
if (cur)
|
||||||
xfs_btree_del_cursor(cur,
|
xfs_btree_del_cursor(cur, error);
|
||||||
error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
|
|
||||||
}
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5439,8 +5435,7 @@ error0:
|
|||||||
if (cur) {
|
if (cur) {
|
||||||
if (!error)
|
if (!error)
|
||||||
cur->bc_private.b.allocated = 0;
|
cur->bc_private.b.allocated = 0;
|
||||||
xfs_btree_del_cursor(cur,
|
xfs_btree_del_cursor(cur, error);
|
||||||
error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
|
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
@ -5700,8 +5695,7 @@ done:
|
|||||||
*next_fsb = got.br_startoff;
|
*next_fsb = got.br_startoff;
|
||||||
del_cursor:
|
del_cursor:
|
||||||
if (cur)
|
if (cur)
|
||||||
xfs_btree_del_cursor(cur,
|
xfs_btree_del_cursor(cur, error);
|
||||||
error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
|
|
||||||
if (logflags)
|
if (logflags)
|
||||||
xfs_trans_log_inode(tp, ip, logflags);
|
xfs_trans_log_inode(tp, ip, logflags);
|
||||||
return error;
|
return error;
|
||||||
@ -5828,8 +5822,7 @@ xfs_bmap_insert_extents(
|
|||||||
*next_fsb = got.br_startoff;
|
*next_fsb = got.br_startoff;
|
||||||
del_cursor:
|
del_cursor:
|
||||||
if (cur)
|
if (cur)
|
||||||
xfs_btree_del_cursor(cur,
|
xfs_btree_del_cursor(cur, error);
|
||||||
error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
|
|
||||||
if (logflags)
|
if (logflags)
|
||||||
xfs_trans_log_inode(tp, ip, logflags);
|
xfs_trans_log_inode(tp, ip, logflags);
|
||||||
return error;
|
return error;
|
||||||
@ -5945,8 +5938,7 @@ xfs_bmap_split_extent_at(
|
|||||||
del_cursor:
|
del_cursor:
|
||||||
if (cur) {
|
if (cur) {
|
||||||
cur->bc_private.b.allocated = 0;
|
cur->bc_private.b.allocated = 0;
|
||||||
xfs_btree_del_cursor(cur,
|
xfs_btree_del_cursor(cur, error);
|
||||||
error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logflags)
|
if (logflags)
|
||||||
|
@ -639,7 +639,7 @@ xfs_bmbt_change_owner(
|
|||||||
cur->bc_private.b.flags |= XFS_BTCUR_BPRV_INVALID_OWNER;
|
cur->bc_private.b.flags |= XFS_BTCUR_BPRV_INVALID_OWNER;
|
||||||
|
|
||||||
error = xfs_btree_change_owner(cur, new_owner, buffer_list);
|
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;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2258,7 +2258,7 @@ xfs_imap_lookup(
|
|||||||
}
|
}
|
||||||
|
|
||||||
xfs_trans_brelse(tp, agbp);
|
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)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
@ -566,7 +566,7 @@ xfs_inobt_count_blocks(
|
|||||||
|
|
||||||
cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno, btnum);
|
cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno, btnum);
|
||||||
error = xfs_btree_count_blocks(cur, tree_blocks);
|
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);
|
xfs_buf_relse(agbp);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
|
@ -1067,7 +1067,7 @@ xfs_refcount_finish_one_cleanup(
|
|||||||
if (rcur == NULL)
|
if (rcur == NULL)
|
||||||
return;
|
return;
|
||||||
agbp = rcur->bc_private.a.agbp;
|
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)
|
if (error)
|
||||||
xfs_trans_brelse(tp, agbp);
|
xfs_trans_brelse(tp, agbp);
|
||||||
}
|
}
|
||||||
|
@ -670,14 +670,8 @@ xfs_rmap_free(
|
|||||||
cur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno);
|
cur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno);
|
||||||
|
|
||||||
error = xfs_rmap_unmap(cur, bno, len, false, oinfo);
|
error = xfs_rmap_unmap(cur, bno, len, false, oinfo);
|
||||||
if (error)
|
|
||||||
goto out_error;
|
|
||||||
|
|
||||||
xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
|
xfs_btree_del_cursor(cur, error);
|
||||||
return 0;
|
|
||||||
|
|
||||||
out_error:
|
|
||||||
xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -912,14 +906,8 @@ xfs_rmap_alloc(
|
|||||||
|
|
||||||
cur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno);
|
cur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno);
|
||||||
error = xfs_rmap_map(cur, bno, len, false, oinfo);
|
error = xfs_rmap_map(cur, bno, len, false, oinfo);
|
||||||
if (error)
|
|
||||||
goto out_error;
|
|
||||||
|
|
||||||
xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
|
xfs_btree_del_cursor(cur, error);
|
||||||
return 0;
|
|
||||||
|
|
||||||
out_error:
|
|
||||||
xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2156,7 +2144,7 @@ xfs_rmap_finish_one_cleanup(
|
|||||||
if (rcur == NULL)
|
if (rcur == NULL)
|
||||||
return;
|
return;
|
||||||
agbp = rcur->bc_private.a.agbp;
|
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)
|
if (error)
|
||||||
xfs_trans_brelse(tp, agbp);
|
xfs_trans_brelse(tp, agbp);
|
||||||
}
|
}
|
||||||
|
@ -404,8 +404,7 @@ xfs_scrub_bmap_btree(
|
|||||||
cur = xfs_bmbt_init_cursor(mp, sc->tp, ip, whichfork);
|
cur = xfs_bmbt_init_cursor(mp, sc->tp, ip, whichfork);
|
||||||
xfs_rmap_ino_bmbt_owner(&oinfo, ip->i_ino, whichfork);
|
xfs_rmap_ino_bmbt_owner(&oinfo, ip->i_ino, whichfork);
|
||||||
error = xfs_scrub_btree(sc, cur, xfs_scrub_bmapbt_rec, &oinfo, info);
|
error = xfs_scrub_btree(sc, cur, xfs_scrub_bmapbt_rec, &oinfo, info);
|
||||||
xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR :
|
xfs_btree_del_cursor(cur, error);
|
||||||
XFS_BTREE_NOERROR);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,7 +513,7 @@ xfs_scrub_bmap_check_ag_rmaps(
|
|||||||
if (error == XFS_BTREE_QUERY_RANGE_ABORT)
|
if (error == XFS_BTREE_QUERY_RANGE_ABORT)
|
||||||
error = 0;
|
error = 0;
|
||||||
|
|
||||||
xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
|
xfs_btree_del_cursor(cur, error);
|
||||||
out_agf:
|
out_agf:
|
||||||
xfs_trans_brelse(sc->tp, agf);
|
xfs_trans_brelse(sc->tp, agf);
|
||||||
return error;
|
return error;
|
||||||
|
@ -1009,7 +1009,7 @@ xfs_repair_find_ag_btree_roots(
|
|||||||
|
|
||||||
cur = xfs_rmapbt_init_cursor(mp, sc->tp, agf_bp, sc->sa.agno);
|
cur = xfs_rmapbt_init_cursor(mp, sc->tp, agf_bp, sc->sa.agno);
|
||||||
error = xfs_rmap_query_all(cur, xfs_repair_findroot_rmap, &ri);
|
error = xfs_rmap_query_all(cur, xfs_repair_findroot_rmap, &ri);
|
||||||
xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
|
xfs_btree_del_cursor(cur, error);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ next_extent:
|
|||||||
}
|
}
|
||||||
|
|
||||||
out_del_cursor:
|
out_del_cursor:
|
||||||
xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
|
xfs_btree_del_cursor(cur, error);
|
||||||
xfs_buf_relse(agbp);
|
xfs_buf_relse(agbp);
|
||||||
out_put_perag:
|
out_put_perag:
|
||||||
xfs_perag_put(pag);
|
xfs_perag_put(pag);
|
||||||
|
@ -219,7 +219,7 @@ xfs_getfsmap_is_shared(
|
|||||||
error = xfs_refcount_find_shared(cur, rec->rm_startblock,
|
error = xfs_refcount_find_shared(cur, rec->rm_startblock,
|
||||||
rec->rm_blockcount, &fbno, &flen, false);
|
rec->rm_blockcount, &fbno, &flen, false);
|
||||||
|
|
||||||
xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
|
xfs_btree_del_cursor(cur, error);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
@ -458,8 +458,7 @@ xfs_bulkstat(
|
|||||||
* pending error, then we are done.
|
* pending error, then we are done.
|
||||||
*/
|
*/
|
||||||
del_cursor:
|
del_cursor:
|
||||||
xfs_btree_del_cursor(cur, error ?
|
xfs_btree_del_cursor(cur, error);
|
||||||
XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
|
|
||||||
xfs_buf_relse(agbp);
|
xfs_buf_relse(agbp);
|
||||||
if (error)
|
if (error)
|
||||||
break;
|
break;
|
||||||
@ -632,8 +631,7 @@ next_ag:
|
|||||||
|
|
||||||
kmem_free(buffer);
|
kmem_free(buffer);
|
||||||
if (cur)
|
if (cur)
|
||||||
xfs_btree_del_cursor(cur, (error ? XFS_BTREE_ERROR :
|
xfs_btree_del_cursor(cur, error);
|
||||||
XFS_BTREE_NOERROR));
|
|
||||||
if (agbp)
|
if (agbp)
|
||||||
xfs_buf_relse(agbp);
|
xfs_buf_relse(agbp);
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ xfs_reflink_find_shared(
|
|||||||
error = xfs_refcount_find_shared(cur, agbno, aglen, fbno, flen,
|
error = xfs_refcount_find_shared(cur, agbno, aglen, fbno, flen,
|
||||||
find_end_of_shared);
|
find_end_of_shared);
|
||||||
|
|
||||||
xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
|
xfs_btree_del_cursor(cur, error);
|
||||||
|
|
||||||
xfs_trans_brelse(tp, agbp);
|
xfs_trans_brelse(tp, agbp);
|
||||||
return error;
|
return error;
|
||||||
|
Loading…
Reference in New Issue
Block a user