/* Visible (exported) allocation/free functions. Some of these are used just by xfs_alloc_btree.c and this file. Compute and fill in value of m_ag_maxlevels.  */
void xfs_alloc_compute_maxlevels(xfs_mount_t *mp)
/* Visible (exported) allocation/free functions. Some of these are used just by xfs_alloc_btree.c and this file. Compute and fill in value of m_ag_maxlevels.  */
void xfs_alloc_compute_maxlevels(xfs_mount_t *mp)
{
	int		level;
	uint		maxblocks;
	uint		maxleafents;
	int		minleafrecs;
	int		minnoderecs;
	maxleafents = (mp->m_sb.sb_agblocks + 1) / 2;
	minleafrecs = mp->m_alloc_mnr[0];
	minnoderecs = mp->m_alloc_mnr[1];
	maxblocks = (maxleafents + minleafrecs - 1) / minleafrecs;
	for (level = 1; maxblocks > 1; level++)
		maxblocks = (maxblocks + minnoderecs - 1) / minnoderecs;
	mp->m_ag_maxlevels = level;
}