/* For non-root nodes this is equivalent to xfs_bmbt_get_maxrecs, but for the root node this checks the available space in the dinode fork so that we can resize the in-memory buffer to match it. After a resize to the maximum size this function returns the same value as xfs_bmbt_get_maxrecs for the root node, too.  */
STATIC int xfs_bmbt_get_dmaxrecs(struct xfs_btree_cur *cur, int level)
/* For non-root nodes this is equivalent to xfs_bmbt_get_maxrecs, but for the root node this checks the available space in the dinode fork so that we can resize the in-memory buffer to match it. After a resize to the maximum size this function returns the same value as xfs_bmbt_get_maxrecs for the root node, too.  */
STATIC int xfs_bmbt_get_dmaxrecs(struct xfs_btree_cur *cur, int level)
{
	if (level != cur->bc_nlevels - 1)
		return cur->bc_mp->m_bmap_dmxr[level != 0];
	return xfs_bmdr_maxrecs(cur->bc_mp, cur->bc_private.b.forksize,
				level == 0);
}