From: Gao Xiang <hsiangkao@redhat.com>
To: linux-xfs@vger.kernel.org
Cc: Gao Xiang <hsiangkao@redhat.com>
Subject: [PATCH 2/3] xfs: kill ialloced in xfs_dialloc()
Date: Tue, 24 Nov 2020 23:51:29 +0800 [thread overview]
Message-ID: <20201124155130.40848-2-hsiangkao@redhat.com> (raw)
In-Reply-To: <20201124155130.40848-1-hsiangkao@redhat.com>
It's enough to just use return code, and get rid of an argument.
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
---
fs/xfs/libxfs/xfs_ialloc.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index 45cf7e55f5ee..5c8b0210aad3 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -607,13 +607,14 @@ xfs_inobt_insert_sprec(
/*
* Allocate new inodes in the allocation group specified by agbp.
- * Return 0 for success, else error code.
+ * Return 0 for successfully allocating some inodes in this AG;
+ * 1 for skipping to allocating in the next AG;
+ * < 0 for 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 +796,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);
/*
@@ -903,7 +903,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;
}
@@ -1715,7 +1714,6 @@ xfs_dialloc(
struct xfs_buf *agbp;
xfs_agnumber_t agno;
int error;
- int ialloced;
bool noroom = false;
xfs_agnumber_t start_agno;
struct xfs_perag *pag;
@@ -1799,8 +1797,8 @@ xfs_dialloc(
goto nextag_relse_buffer;
- error = xfs_ialloc_ag_alloc(tp, agbp, &ialloced);
- if (error) {
+ error = xfs_ialloc_ag_alloc(tp, agbp);
+ if (error < 0) {
xfs_trans_brelse(tp, agbp);
if (error != -ENOSPC)
@@ -1811,7 +1809,7 @@ xfs_dialloc(
return 0;
}
- if (ialloced) {
+ if (!error) {
/*
* We successfully allocated some inodes, return
* the current context to the caller so that it
--
2.18.4
next prev parent reply other threads:[~2020-11-24 15:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-24 15:51 [PATCH 1/3] xfs: convert noroom, okalloc in xfs_dialloc() to bool Gao Xiang
2020-11-24 15:51 ` Gao Xiang [this message]
2020-12-01 10:21 ` [PATCH 2/3] xfs: kill ialloced in xfs_dialloc() Christoph Hellwig
2020-12-01 11:55 ` Gao Xiang
2020-12-01 16:55 ` Darrick J. Wong
2020-12-01 23:50 ` Gao Xiang
2020-12-01 17:04 ` Darrick J. Wong
2020-12-01 23:59 ` Gao Xiang
2020-11-24 15:51 ` [PATCH 3/3] xfs: clean up xfs_dialloc() by introducing __xfs_dialloc() Gao Xiang
2020-11-24 22:16 ` Dave Chinner
2020-11-24 23:14 ` Gao Xiang
2020-12-01 10:19 ` [PATCH 1/3] xfs: convert noroom, okalloc in xfs_dialloc() to bool Christoph Hellwig
2020-12-01 16:56 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201124155130.40848-2-hsiangkao@redhat.com \
--to=hsiangkao@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox