summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGao Xiang <hsiangkao@redhat.com>2020-12-09 10:05:17 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2020-12-09 19:10:42 -0800
commit975c66314e525b9037bc97f83fe91c0ced21a0fd (patch)
tree1e576e96dc988dcf0886c2b50f798eb39f5809b9
parent5c2fde59fd8752c862d1bd03af7eca0271b5b3dc (diff)
xfs: kill ialloced in xfs_dialloc()dialloc-refactorings-5.11_2020-12-09
It's enough to just use return code, and get rid of an argument. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Gao Xiang <hsiangkao@redhat.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-rw-r--r--fs/xfs/libxfs/xfs_ialloc.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index 4c45d0bb17ba..d58607cda477 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -607,13 +607,13 @@ error:
/*
* Allocate new inodes in the allocation group specified by agbp.
- * Return 0 for success, else error code.
+ * Returns 0 if inodes were allocated in this AG; 1 if there was no space
+ * in this AG; or the usual negative error code.
*/
STATIC int
xfs_ialloc_ag_alloc(
struct xfs_trans *tp,
- struct xfs_buf *agbp,
- int *alloc)
+ struct xfs_buf *agbp)
{
struct xfs_agi *agi;
struct xfs_alloc_arg args;
@@ -795,10 +795,9 @@ sparse_alloc:
allocmask = (1 << (newlen / XFS_INODES_PER_HOLEMASK_BIT)) - 1;
}
- if (args.fsbno == NULLFSBLOCK) {
- *alloc = 0;
- return 0;
- }
+ if (args.fsbno == NULLFSBLOCK)
+ return 1;
+
ASSERT(args.len == args.minlen);
/*
@@ -903,7 +902,6 @@ sparse_alloc:
*/
xfs_trans_mod_sb(tp, XFS_TRANS_SB_ICOUNT, (long)newlen);
xfs_trans_mod_sb(tp, XFS_TRANS_SB_IFREE, (long)newlen);
- *alloc = 1;
return 0;
}
@@ -1739,7 +1737,6 @@ xfs_dialloc_select_ag(
struct xfs_buf *agbp;
xfs_agnumber_t agno;
int error;
- int ialloced;
bool noroom = false;
xfs_agnumber_t start_agno;
struct xfs_perag *pag;
@@ -1812,9 +1809,8 @@ xfs_dialloc_select_ag(
if (!okalloc)
goto nextag_relse_buffer;
-
- error = xfs_ialloc_ag_alloc(*tpp, agbp, &ialloced);
- if (error) {
+ error = xfs_ialloc_ag_alloc(*tpp, agbp);
+ if (error < 0) {
xfs_trans_brelse(*tpp, agbp);
if (error == -ENOSPC)
@@ -1822,7 +1818,7 @@ xfs_dialloc_select_ag(
break;
}
- if (ialloced) {
+ if (error == 0) {
/*
* We successfully allocated space for an inode cluster
* in this AG. Roll the transaction so that we can