]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: pass perag to xfs_read_agi
authorDave Chinner <dchinner@redhat.com>
Mon, 22 Aug 2022 12:13:37 +0000 (14:13 +0200)
committerCarlos Maiolino <cem@kernel.org>
Tue, 30 Aug 2022 07:54:27 +0000 (09:54 +0200)
Source kernel commit: 61021deb1faa5b2b913bf0ad76e2769276160b04

We have the perag in most palces we call xfs_read_agi, so pass the
perag instead of a mount/agno pair.

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_ialloc.c
libxfs/xfs_ialloc.h

index f3087cb96f1f12bbde8572bb73a021bbbfad1edb..60f74b4b277f073f7bab3fcb88445e96a30bc7db 100644 (file)
@@ -2566,25 +2566,24 @@ const struct xfs_buf_ops xfs_agi_buf_ops = {
  */
 int
 xfs_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_perag        *pag,
+       struct xfs_trans        *tp,
+       struct xfs_buf          **agibpp)
 {
+       struct xfs_mount        *mp = pag->pag_mount;
        int                     error;
 
-       trace_xfs_read_agi(mp, agno);
+       trace_xfs_read_agi(pag->pag_mount, pag->pag_agno);
 
-       ASSERT(agno != NULLAGNUMBER);
        error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
-                       XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)),
-                       XFS_FSS_TO_BB(mp, 1), 0, bpp, &xfs_agi_buf_ops);
+                       XFS_AG_DADDR(mp, pag->pag_agno, XFS_AGI_DADDR(mp)),
+                       XFS_FSS_TO_BB(mp, 1), 0, agibpp, &xfs_agi_buf_ops);
        if (error)
                return error;
        if (tp)
-               xfs_trans_buf_set_type(tp, *bpp, XFS_BLFT_AGI_BUF);
+               xfs_trans_buf_set_type(tp, *agibpp, XFS_BLFT_AGI_BUF);
 
-       xfs_buf_set_ref(*bpp, XFS_AGI_REF);
+       xfs_buf_set_ref(*agibpp, XFS_AGI_REF);
        return 0;
 }
 
@@ -2604,7 +2603,7 @@ xfs_ialloc_read_agi(
 
        trace_xfs_ialloc_read_agi(pag->pag_mount, pag->pag_agno);
 
-       error = xfs_read_agi(pag->pag_mount, tp, pag->pag_agno, &agibp);
+       error = xfs_read_agi(pag, tp, &agibp);
        if (error)
                return error;
 
index 72cb33170d9fe35e8f1dafc87e1feeb1cd3790c6..9bbbca6ac4edf9c00ae5fc0dd53da51c72be775e 100644 (file)
@@ -62,11 +62,9 @@ xfs_ialloc_log_agi(
        struct xfs_buf  *bp,            /* allocation group header buffer */
        uint32_t        fields);        /* bitmask of fields to log */
 
-/*
- * Read in the allocation group header (inode allocation section)
- */
-int                                    /* error */
-xfs_ialloc_read_agi(struct xfs_perag *pag, struct xfs_trans *tp,
+int xfs_read_agi(struct xfs_perag *pag, struct xfs_trans *tp,
+               struct xfs_buf **agibpp);
+int xfs_ialloc_read_agi(struct xfs_perag *pag, struct xfs_trans *tp,
                struct xfs_buf **agibpp);
 
 /*
@@ -89,8 +87,6 @@ int xfs_ialloc_inode_init(struct xfs_mount *mp, struct xfs_trans *tp,
                          xfs_agnumber_t agno, xfs_agblock_t agbno,
                          xfs_agblock_t length, unsigned int gen);
 
-int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp,
-               xfs_agnumber_t agno, struct xfs_buf **bpp);
 
 union xfs_btree_rec;
 void xfs_inobt_btrec_to_irec(struct xfs_mount *mp,