/* Compute aligned version of the found extent. Takes alignment and min length into account.  */
STATIC void xfs_alloc_compute_aligned(xfs_agblock_t foundbno, xfs_extlen_t foundlen, xfs_extlen_t alignment, xfs_extlen_t minlen, xfs_agblock_t *resbno, xfs_extlen_t *reslen)
/* Compute aligned version of the found extent. Takes alignment and min length into account.  */
STATIC void xfs_alloc_compute_aligned(xfs_agblock_t foundbno, xfs_extlen_t foundlen, xfs_extlen_t alignment, xfs_extlen_t minlen, xfs_agblock_t *resbno, xfs_extlen_t *reslen)
{
	xfs_agblock_t	bno;
	xfs_extlen_t	diff;
	xfs_extlen_t	len;
	if (alignment > 1 && foundlen >= minlen) {
		bno = roundup(foundbno, alignment);
		diff = bno - foundbno;
		len = diff >= foundlen ? 0 : foundlen - diff;
	} else {
		bno = foundbno;
		len = foundlen;
	}
	*resbno = bno;
	*reslen = len;
}