]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: replace xfs_ag_block_count() with perag accesses
authorDave Chinner <dchinner@redhat.com>
Mon, 22 Aug 2022 14:16:22 +0000 (16:16 +0200)
committerCarlos Maiolino <cem@kernel.org>
Tue, 30 Aug 2022 08:12:58 +0000 (10:12 +0200)
Source kernel commit: 3829c9a10fc7da40194ec9860df8c557c2b86ed8

Many of the places that call xfs_ag_block_count() have a perag
available. These places can just read pag->block_count directly
instead of calculating the AG block count from first principles.

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_btree.c

index fe8df688b0ecb2e6fa6eed8a7851954fd4ac7118..67fe535ff2d0419d14b8735cefc0c253539edea6 100644 (file)
@@ -682,10 +682,10 @@ xfs_inobt_rec_check_count(
 
 static xfs_extlen_t
 xfs_inobt_max_size(
-       struct xfs_mount        *mp,
-       xfs_agnumber_t          agno)
+       struct xfs_perag        *pag)
 {
-       xfs_agblock_t           agblocks = xfs_ag_block_count(mp, agno);
+       struct xfs_mount        *mp = pag->pag_mount;
+       xfs_agblock_t           agblocks = pag->block_count;
 
        /* Bail out if we're uninitialized, which can happen in mkfs. */
        if (M_IGEO(mp)->inobt_mxr[0] == 0)
@@ -697,7 +697,7 @@ xfs_inobt_max_size(
         * expansion.  We therefore can pretend the space isn't there.
         */
        if (mp->m_sb.sb_logstart &&
-           XFS_FSB_TO_AGNO(mp, mp->m_sb.sb_logstart) == agno)
+           XFS_FSB_TO_AGNO(mp, mp->m_sb.sb_logstart) == pag->pag_agno)
                agblocks -= mp->m_sb.sb_logblocks;
 
        return xfs_btree_calc_size(M_IGEO(mp)->inobt_mnr,
@@ -799,7 +799,7 @@ xfs_finobt_calc_reserves(
        if (error)
                return error;
 
-       *ask += xfs_inobt_max_size(mp, pag->pag_agno);
+       *ask += xfs_inobt_max_size(pag);
        *used += tree_len;
        return 0;
 }