xfs: get rid of notinit from xfs_bmap_longest_free_extent
authorDave Chinner <dchinner@redhat.com>
Sun, 12 Feb 2023 22:14:55 +0000 (09:14 +1100)
committerDave Chinner <dchinner@redhat.com>
Sun, 12 Feb 2023 22:14:55 +0000 (09:14 +1100)
commit6b637ad0c7be85ecb795697ea51051039b753da2
treed99c5abc704aedf3bf65bb846bc1207f0eead043
parent89563e7dc099343bf7792515452e1a24005d98a6
xfs: get rid of notinit from xfs_bmap_longest_free_extent

It is only set if reading the AGF gets a EAGAIN error. Just return
the EAGAIN error and handle that error in the callers.

This means we can remove the not_init parameter from
xfs_bmap_select_minlen(), too, because the use of not_init there is
pessimistic. If we can't read the agf, it won't increase blen.

The only time we actually care whether we checked all the AGFs for
contiguous free space is when the best length is less than the
minimum allocation length. If not_init is set, then we ignore blen
and set the minimum alloc length to the absolute minimum, not the
best length we know already is present.

However, if blen is less than the minimum we're going to ignore it
anyway, regardless of whether we scanned all the AGFs or not.  Hence
not_init can go away, because we only use if blen is good from
the scanned AGs otherwise we ignore it altogether and use minlen.

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