Commit c49a4b2f authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

xfs: fold xfs_rmapbt_init_common into xfs_rmapbt_init_cursor

Make the levels initialization in xfs_rmapbt_init_cursor conditional
and merge the two helpers.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
parent a5c21944
...@@ -502,10 +502,16 @@ const struct xfs_btree_ops xfs_rmapbt_ops = { ...@@ -502,10 +502,16 @@ const struct xfs_btree_ops xfs_rmapbt_ops = {
.keys_contiguous = xfs_rmapbt_keys_contiguous, .keys_contiguous = xfs_rmapbt_keys_contiguous,
}; };
static struct xfs_btree_cur * /*
xfs_rmapbt_init_common( * Create a new reverse mapping btree cursor.
*
* For staging cursors tp and agbp are NULL.
*/
struct xfs_btree_cur *
xfs_rmapbt_init_cursor(
struct xfs_mount *mp, struct xfs_mount *mp,
struct xfs_trans *tp, struct xfs_trans *tp,
struct xfs_buf *agbp,
struct xfs_perag *pag) struct xfs_perag *pag)
{ {
struct xfs_btree_cur *cur; struct xfs_btree_cur *cur;
...@@ -513,23 +519,12 @@ xfs_rmapbt_init_common( ...@@ -513,23 +519,12 @@ xfs_rmapbt_init_common(
cur = xfs_btree_alloc_cursor(mp, tp, XFS_BTNUM_RMAP, &xfs_rmapbt_ops, cur = xfs_btree_alloc_cursor(mp, tp, XFS_BTNUM_RMAP, &xfs_rmapbt_ops,
mp->m_rmap_maxlevels, xfs_rmapbt_cur_cache); mp->m_rmap_maxlevels, xfs_rmapbt_cur_cache);
cur->bc_ag.pag = xfs_perag_hold(pag); cur->bc_ag.pag = xfs_perag_hold(pag);
return cur; cur->bc_ag.agbp = agbp;
} if (agbp) {
/* Create a new reverse mapping btree cursor. */
struct xfs_btree_cur *
xfs_rmapbt_init_cursor(
struct xfs_mount *mp,
struct xfs_trans *tp,
struct xfs_buf *agbp,
struct xfs_perag *pag)
{
struct xfs_agf *agf = agbp->b_addr; struct xfs_agf *agf = agbp->b_addr;
struct xfs_btree_cur *cur;
cur = xfs_rmapbt_init_common(mp, tp, pag);
cur->bc_nlevels = be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAP]); cur->bc_nlevels = be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAP]);
cur->bc_ag.agbp = agbp; }
return cur; return cur;
} }
...@@ -542,7 +537,7 @@ xfs_rmapbt_stage_cursor( ...@@ -542,7 +537,7 @@ xfs_rmapbt_stage_cursor(
{ {
struct xfs_btree_cur *cur; struct xfs_btree_cur *cur;
cur = xfs_rmapbt_init_common(mp, NULL, pag); cur = xfs_rmapbt_init_cursor(mp, NULL, NULL, pag);
xfs_btree_stage_afakeroot(cur, afake); xfs_btree_stage_afakeroot(cur, afake);
return cur; return cur;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment