Skip to content

Commit

Permalink
xfs: kill ialloced in xfs_dialloc()
Browse files Browse the repository at this point in the history
It's enough to just use return code, and get rid of an argument.

Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Darrick J. Wong <[email protected]>
Reviewed-by: Dave Chinner <[email protected]>
Signed-off-by: Gao Xiang <[email protected]>
Signed-off-by: Darrick J. Wong <[email protected]>
  • Loading branch information
Gao Xiang authored and djwong committed Dec 12, 2020
1 parent 8d822dc commit 3937493
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions fs/xfs/libxfs/xfs_ialloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,13 +607,13 @@ xfs_inobt_insert_sprec(

/*
* 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;
Expand Down Expand Up @@ -795,10 +795,9 @@ xfs_ialloc_ag_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);

/*
Expand Down Expand Up @@ -903,7 +902,6 @@ xfs_ialloc_ag_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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1812,17 +1809,16 @@ 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)
error = 0;
break;
}

if (ialloced) {
if (error == 0) {
/*
* We successfully allocated space for an inode cluster
* in this AG. Roll the transaction so that we can
Expand Down

0 comments on commit 3937493

Please sign in to comment.