xfs: introduce xfs_for_each_perag_wrap()
authorDave Chinner <dchinner@redhat.com>
Sun, 12 Feb 2023 22:14:53 +0000 (09:14 +1100)
committerDave Chinner <dchinner@redhat.com>
Sun, 12 Feb 2023 22:14:53 +0000 (09:14 +1100)
commit76257a15873ccce817e0c4441f6bb66fb8f8201c
treea75763d4aaabb7bb276b9b542ad88c6eb0e482c4
parent7ac2ff8bb3713c7cb43564c04384af2ee7cc1f8d
xfs: introduce xfs_for_each_perag_wrap()

In several places we iterate every AG from a specific start agno and
wrap back to the first AG when we reach the end of the filesystem to
continue searching. We don't have a primitive for this iteration
yet, so add one for conversion of these algorithms to per-ag based
iteration.

The filestream AG select code is a mess, and this initially makes it
worse. The per-ag selection needs to be driven completely into the
filestream code to clean this up and it will be done in a future
patch that makes the filestream allocator use active per-ag
references correctly.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
fs/xfs/libxfs/xfs_ag.h
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/libxfs/xfs_ialloc.c