xfs: simplify xfs_dialloc_select_ag() return values

The only caller of xfs_dialloc_select_ag() will always return
-ENOSPC to it's caller if the agbp returned from
xfs_dialloc_select_ag() is NULL. IOWs, failure to find a candidate
AGI we can allocate inodes from is always an ENOSPC condition, so
move this logic up into xfs_dialloc_select_ag() so we can simplify
the return logic in this function.

xfs_dialloc_select_ag() now only ever returns 0 with a locked
agbp, or an error with no agbp.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
This commit is contained in:
Dave Chinner
2021-06-02 10:48:24 +10:00
committed by Dave Chinner
parent 50f02fe333
commit 4268547305
2 changed files with 8 additions and 18 deletions

View File

@@ -923,9 +923,6 @@ xfs_dir_ialloc(
if (error)
return error;
if (!agibp)
return -ENOSPC;
/* Allocate an inode from the selected AG */
error = xfs_dialloc_ag(*tpp, agibp, parent_ino, &ino);
if (error)