]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: kill xfs_ialloc_pagi_init()
authorDave Chinner <dchinner@redhat.com>
Mon, 22 Aug 2022 10:50:59 +0000 (12:50 +0200)
committerCarlos Maiolino <cem@kernel.org>
Tue, 30 Aug 2022 07:43:40 +0000 (09:43 +0200)
Source kernel commit: a95fee40e3d433d8fabff7c02e75f7c2c2e54400

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>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
libxfs/xfs_ag.c
libxfs/xfs_ialloc.c
libxfs/xfs_ialloc.h

index 652069c22be4b9464acb15b13c8270576aab1113..fa884ae7cb2a52d9f096d6badf503c262e114ab1 100644 (file)
@@ -126,9 +126,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;
index 63490bc5635f465f349db5ccc1c4ba65083cf2d3..f2ab1d424a1545df3880b254f2c98cc9dcd16a98 100644 (file)
@@ -1605,7 +1605,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;
        }
@@ -2588,25 +2588,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);
@@ -2619,26 +2624,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;
 }
 
index a7705b6a1fd32968a0f0e61f0039f130ae2660c4..1ff42bf1e4b33c1c2d301e52549d59131a9cd30a 100644 (file)
@@ -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.
  */