From: Dave Chinner <david@fromorbit.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH 02/14] xfs: kill xfs_ialloc_pagi_init()
Date: Mon, 27 Jun 2022 10:18:20 +1000 [thread overview]
Message-ID: <20220627001832.215779-3-david@fromorbit.com> (raw)
In-Reply-To: <20220627001832.215779-1-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
This is just a basic wrapper around xfs_ialloc_read_agi(), which can
be entirely handled by xfs_ialloc_read_agi() by passing a NULL
agibpp....
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/libxfs/xfs_ag.c | 3 ++-
fs/xfs/libxfs/xfs_ialloc.c | 39 ++++++++++++++------------------------
fs/xfs/libxfs/xfs_ialloc.h | 10 ----------
3 files changed, 16 insertions(+), 36 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_ag.c b/fs/xfs/libxfs/xfs_ag.c
index 4bb316d89e57..c203dc883f5d 100644
--- a/fs/xfs/libxfs/xfs_ag.c
+++ b/fs/xfs/libxfs/xfs_ag.c
@@ -128,9 +128,10 @@ xfs_initialize_perag_data(
if (error)
return error;
- error = xfs_ialloc_pagi_init(mp, NULL, index);
+ error = xfs_ialloc_read_agi(mp, NULL, index, NULL);
if (error)
return error;
+
pag = xfs_perag_get(mp, index);
ifree += pag->pagi_freecount;
ialloc += pag->pagi_count;
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index bf2f4bc89193..cefac2a1ba0c 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -1610,7 +1610,7 @@ xfs_dialloc_good_ag(
return false;
if (!pag->pagi_init) {
- error = xfs_ialloc_pagi_init(mp, tp, pag->pag_agno);
+ error = xfs_ialloc_read_agi(mp, tp, pag->pag_agno, NULL);
if (error)
return false;
}
@@ -2593,25 +2593,30 @@ xfs_read_agi(
return 0;
}
+/*
+ * Read in the agi and initialise the per-ag data. If the caller supplies a
+ * @agibpp, return the locked AGI buffer to them, otherwise release it.
+ */
int
xfs_ialloc_read_agi(
struct xfs_mount *mp, /* file system mount structure */
struct xfs_trans *tp, /* transaction pointer */
xfs_agnumber_t agno, /* allocation group number */
- struct xfs_buf **bpp) /* allocation group hdr buf */
+ struct xfs_buf **agibpp)
{
+ struct xfs_buf *agibp;
struct xfs_agi *agi; /* allocation group header */
struct xfs_perag *pag; /* per allocation group data */
int error;
trace_xfs_ialloc_read_agi(mp, agno);
- error = xfs_read_agi(mp, tp, agno, bpp);
+ error = xfs_read_agi(mp, tp, agno, &agibp);
if (error)
return error;
- agi = (*bpp)->b_addr;
- pag = (*bpp)->b_pag;
+ agi = agibp->b_addr;
+ pag = agibp->b_pag;
if (!pag->pagi_init) {
pag->pagi_freecount = be32_to_cpu(agi->agi_freecount);
pag->pagi_count = be32_to_cpu(agi->agi_count);
@@ -2624,26 +2629,10 @@ xfs_ialloc_read_agi(
*/
ASSERT(pag->pagi_freecount == be32_to_cpu(agi->agi_freecount) ||
xfs_is_shutdown(mp));
- return 0;
-}
-
-/*
- * Read in the agi to initialise the per-ag data in the mount structure
- */
-int
-xfs_ialloc_pagi_init(
- xfs_mount_t *mp, /* file system mount structure */
- xfs_trans_t *tp, /* transaction pointer */
- xfs_agnumber_t agno) /* allocation group number */
-{
- struct xfs_buf *bp = NULL;
- int error;
-
- error = xfs_ialloc_read_agi(mp, tp, agno, &bp);
- if (error)
- return error;
- if (bp)
- xfs_trans_brelse(tp, bp);
+ if (agibpp)
+ *agibpp = agibp;
+ else
+ xfs_trans_brelse(tp, agibp);
return 0;
}
diff --git a/fs/xfs/libxfs/xfs_ialloc.h b/fs/xfs/libxfs/xfs_ialloc.h
index a7705b6a1fd3..1ff42bf1e4b3 100644
--- a/fs/xfs/libxfs/xfs_ialloc.h
+++ b/fs/xfs/libxfs/xfs_ialloc.h
@@ -72,16 +72,6 @@ xfs_ialloc_read_agi(
xfs_agnumber_t agno, /* allocation group number */
struct xfs_buf **bpp); /* allocation group hdr buf */
-/*
- * Read in the allocation group header to initialise the per-ag data
- * in the mount structure
- */
-int
-xfs_ialloc_pagi_init(
- struct xfs_mount *mp, /* file system mount structure */
- struct xfs_trans *tp, /* transaction pointer */
- xfs_agnumber_t agno); /* allocation group number */
-
/*
* Lookup a record by ino in the btree given by cur.
*/
--
2.36.1
next prev parent reply other threads:[~2022-06-27 0:18 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-27 0:18 [PATCH 00/14] xfs: perag conversions for 5.20 Dave Chinner
2022-06-27 0:18 ` [PATCH 01/14] xfs: make last AG grow/shrink perag centric Dave Chinner
2022-06-27 0:18 ` Dave Chinner [this message]
2022-06-27 0:18 ` [PATCH 03/14] xfs: pass perag to xfs_ialloc_read_agi() Dave Chinner
2022-06-27 0:18 ` [PATCH 04/14] xfs: kill xfs_alloc_pagf_init() Dave Chinner
2022-06-27 0:18 ` [PATCH 05/14] xfs: pass perag to xfs_alloc_read_agf() Dave Chinner
2022-06-29 6:58 ` Christoph Hellwig
2022-06-27 0:18 ` [PATCH 06/14] xfs: pass perag to xfs_read_agi Dave Chinner
2022-06-27 0:18 ` [PATCH 07/14] xfs: pass perag to xfs_read_agf Dave Chinner
2022-06-27 0:18 ` [PATCH 08/14] xfs: pass perag to xfs_alloc_get_freelist Dave Chinner
2022-06-27 0:18 ` [PATCH 09/14] xfs: pass perag to xfs_alloc_put_freelist Dave Chinner
2022-06-27 0:18 ` [PATCH 10/14] xfs: pass perag to xfs_alloc_read_agfl Dave Chinner
2022-06-27 0:18 ` [PATCH 11/14] xfs: Pre-calculate per-AG agbno geometry Dave Chinner
2022-06-29 7:00 ` Christoph Hellwig
2022-06-27 0:18 ` [PATCH 12/14] xfs: Pre-calculate per-AG agino geometry Dave Chinner
2022-06-29 7:02 ` Christoph Hellwig
2022-06-27 0:18 ` [PATCH 13/14] xfs: replace xfs_ag_block_count() with perag accesses Dave Chinner
2022-06-29 7:02 ` Christoph Hellwig
2022-06-27 0:18 ` [PATCH 14/14] xfs: make is_log_ag() a first class helper Dave Chinner
2022-06-29 7:03 ` Christoph Hellwig
2022-06-29 20:26 ` [PATCH 00/14] xfs: perag conversions for 5.20 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=20220627001832.215779-3-david@fromorbit.com \
--to=david@fromorbit.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;
as well as URLs for NNTP newsgroup(s).