/* Return a new incore dquot. Depending on the number of dquots in the system, we either allocate a new one on the kernel heap, or reclaim a free one. Return value is B_TRUE if we allocated a new dquot, B_FALSE if we managed to reclaim an existing one from the freelist.  */
boolean_t xfs_qm_dqalloc_incore(xfs_dquot_t **O_dqpp)
/* Return a new incore dquot. Depending on the number of dquots in the system, we either allocate a new one on the kernel heap, or reclaim a free one. Return value is B_TRUE if we allocated a new dquot, B_FALSE if we managed to reclaim an existing one from the freelist.  */
boolean_t xfs_qm_dqalloc_incore(xfs_dquot_t **O_dqpp)
{
	xfs_dquot_t	*dqp;
	if (atomic_read(&xfs_Gqm->qm_totaldquots) >= ndquot) {
		if ((dqp = xfs_qm_dqreclaim_one())) {
			XQM_STATS_INC(xqmstats.xs_qm_dqreclaims);
			memset(&dqp->q_core, 0, sizeof(dqp->q_core));
			*O_dqpp = dqp;
			return B_FALSE;
		}
		XQM_STATS_INC(xqmstats.xs_qm_dqreclaim_misses);
	}
	ASSERT(xfs_Gqm->qm_dqzone != NULL);
	*O_dqpp = kmem_zone_zalloc(xfs_Gqm->qm_dqzone, KM_SLEEP);
	atomic_inc(&xfs_Gqm->qm_totaldquots);
	return B_TRUE;
}