xfs: move the minimum agno checks into xfs_alloc_vextent_check_args
authorDave Chinner <dchinner@redhat.com>
Sun, 12 Feb 2023 22:14:54 +0000 (09:14 +1100)
committerDave Chinner <dchinner@redhat.com>
Sun, 12 Feb 2023 22:14:54 +0000 (09:14 +1100)
commit8b81356825ffb96b3b167b4dabbbbdb506bb0e0b
tree840748e7d638bc622a8d634bfe82b44fd6d49b75
parent230e8fe8462ffda0849ea40b61dcf9f233854076
xfs: move the minimum agno checks into xfs_alloc_vextent_check_args

All of the allocation functions now extract the minimum allowed AG
from the transaction and then use it in some way. The allocation
functions that are restricted to a single AG all check if the
AG requested can be allocated from and return an error if so. These
all set args->agno appropriately.

All the allocation functions that iterate AGs use it to calculate
the scan start AG. args->agno is not set until the iterator starts
walking AGs.

Hence we can easily set up a conditional check against the minimum
AG allowed in xfs_alloc_vextent_check_args() based on whether
args->agno contains NULLAGNUMBER or not and move all the repeated
setup code to xfs_alloc_vextent_check_args(), further simplifying
the allocation functions.

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