xfs: factor agf counter updates into a helper