aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_ialloc_btree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_ialloc_btree.c')
-rw-r--r--fs/xfs/xfs_ialloc_btree.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/fs/xfs/xfs_ialloc_btree.c b/fs/xfs/xfs_ialloc_btree.c
index 83502f3edef0..8c0c4748a8df 100644
--- a/fs/xfs/xfs_ialloc_btree.c
+++ b/fs/xfs/xfs_ialloc_btree.c
@@ -2076,3 +2076,44 @@ xfs_inobt_update(
2076 } 2076 }
2077 return 0; 2077 return 0;
2078} 2078}
2079
2080STATIC struct xfs_btree_cur *
2081xfs_inobt_dup_cursor(
2082 struct xfs_btree_cur *cur)
2083{
2084 return xfs_inobt_init_cursor(cur->bc_mp, cur->bc_tp,
2085 cur->bc_private.a.agbp, cur->bc_private.a.agno);
2086}
2087
2088static const struct xfs_btree_ops xfs_inobt_ops = {
2089 .dup_cursor = xfs_inobt_dup_cursor,
2090};
2091
2092/*
2093 * Allocate a new inode btree cursor.
2094 */
2095struct xfs_btree_cur * /* new inode btree cursor */
2096xfs_inobt_init_cursor(
2097 struct xfs_mount *mp, /* file system mount point */
2098 struct xfs_trans *tp, /* transaction pointer */
2099 struct xfs_buf *agbp, /* buffer for agi structure */
2100 xfs_agnumber_t agno) /* allocation group number */
2101{
2102 struct xfs_agi *agi = XFS_BUF_TO_AGI(agbp);
2103 struct xfs_btree_cur *cur;
2104
2105 cur = kmem_zone_zalloc(xfs_btree_cur_zone, KM_SLEEP);
2106
2107 cur->bc_tp = tp;
2108 cur->bc_mp = mp;
2109 cur->bc_nlevels = be32_to_cpu(agi->agi_level);
2110 cur->bc_btnum = XFS_BTNUM_INO;
2111 cur->bc_blocklog = mp->m_sb.sb_blocklog;
2112
2113 cur->bc_ops = &xfs_inobt_ops;
2114
2115 cur->bc_private.a.agbp = agbp;
2116 cur->bc_private.a.agno = agno;
2117
2118 return cur;
2119}