/* Fix up length if there is too little space left in the a.g. Return 1 if ok, 0 if too little, should give up.  */
STATIC int xfs_alloc_fix_minleft(xfs_alloc_arg_t *args)
/* Fix up length if there is too little space left in the a.g. Return 1 if ok, 0 if too little, should give up.  */
STATIC int xfs_alloc_fix_minleft(xfs_alloc_arg_t *args)
{
	xfs_agf_t	*agf;
	int		diff;
	if (args->minleft == 0)
		return 1;
	agf = XFS_BUF_TO_AGF(args->agbp);
	diff = be32_to_cpu(agf->agf_freeblks)
		+ be32_to_cpu(agf->agf_flcount)
		- args->len - args->minleft;
	if (diff >= 0)
		return 1;
	args->len += diff;
	if (args->len >= args->minlen)
		return 1;
	args->agbno = NULLAGBLOCK;
	return 0;
}