/* The kmem_shake interface is invoked when memory is running low.  */
STATIC int xfs_qm_shake(int, gfp_t)
/* The kmem_shake interface is invoked when memory is running low.  */
STATIC int xfs_qm_shake(int, gfp_t)
{
	int	ndqused, nfree, n;
	if (!kmem_shake_allow(gfp_mask))
		return 0;
	if (!xfs_Gqm)
		return 0;
	nfree = xfs_Gqm->qm_dqfreelist.qh_nelems;
	ndqused = atomic_read(&xfs_Gqm->qm_totaldquots) - nfree;
	ASSERT(ndqused >= 0);
	if (nfree <= ndqused && nfree < ndquot)
		return 0;
	ndqused *= xfs_Gqm->qm_dqfree_ratio;
	n = nfree - ndqused - ndquot;
	return xfs_qm_shake_freelist(MAX(nfree, n));
}