xfs: factor out code to find the longest free extent in the AG