Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfs: pass perag to xfs_alloc_read_agfl

We have the perag in most places we call xfs_alloc_read_agfl, 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>

authored by

Dave Chinner and committed by
Dave Chinner
cec7bb7d 8c392eb2

+20 -19
+16 -15
fs/xfs/libxfs/xfs_alloc.c
··· 703 703 /* 704 704 * Read in the allocation group free block array. 705 705 */ 706 - int /* error */ 706 + int 707 707 xfs_alloc_read_agfl( 708 - xfs_mount_t *mp, /* mount point structure */ 709 - xfs_trans_t *tp, /* transaction pointer */ 710 - xfs_agnumber_t agno, /* allocation group number */ 711 - struct xfs_buf **bpp) /* buffer for the ag free block array */ 708 + struct xfs_perag *pag, 709 + struct xfs_trans *tp, 710 + struct xfs_buf **bpp) 712 711 { 713 - struct xfs_buf *bp; /* return value */ 714 - int error; 712 + struct xfs_mount *mp = pag->pag_mount; 713 + struct xfs_buf *bp; 714 + int error; 715 715 716 - ASSERT(agno != NULLAGNUMBER); 717 716 error = xfs_trans_read_buf( 718 717 mp, tp, mp->m_ddev_targp, 719 - XFS_AG_DADDR(mp, agno, XFS_AGFL_DADDR(mp)), 718 + XFS_AG_DADDR(mp, pag->pag_agno, XFS_AGFL_DADDR(mp)), 720 719 XFS_FSS_TO_BB(mp, 1), 0, &bp, &xfs_agfl_buf_ops); 721 720 if (error) 722 721 return error; ··· 2712 2713 targs.alignment = targs.minlen = targs.prod = 1; 2713 2714 targs.type = XFS_ALLOCTYPE_THIS_AG; 2714 2715 targs.pag = pag; 2715 - error = xfs_alloc_read_agfl(mp, tp, targs.agno, &agflbp); 2716 + error = xfs_alloc_read_agfl(pag, tp, &agflbp); 2716 2717 if (error) 2717 2718 goto out_agbp_relse; 2718 2719 ··· 2791 2792 /* 2792 2793 * Read the array of free blocks. 2793 2794 */ 2794 - error = xfs_alloc_read_agfl(mp, tp, be32_to_cpu(agf->agf_seqno), 2795 - &agflbp); 2795 + error = xfs_alloc_read_agfl(pag, tp, &agflbp); 2796 2796 if (error) 2797 2797 return error; 2798 2798 ··· 2885 2887 __be32 *agfl_bno; 2886 2888 int startoff; 2887 2889 2888 - if (!agflbp && (error = xfs_alloc_read_agfl(mp, tp, 2889 - be32_to_cpu(agf->agf_seqno), &agflbp))) 2890 - return error; 2890 + if (!agflbp) { 2891 + error = xfs_alloc_read_agfl(pag, tp, &agflbp); 2892 + if (error) 2893 + return error; 2894 + } 2895 + 2891 2896 be32_add_cpu(&agf->agf_fllast, 1); 2892 2897 if (be32_to_cpu(agf->agf_fllast) == xfs_agfl_size(mp)) 2893 2898 agf->agf_fllast = 0;
+2 -2
fs/xfs/libxfs/xfs_alloc.h
··· 172 172 struct xfs_buf **agfbpp); 173 173 int xfs_alloc_read_agf(struct xfs_perag *pag, struct xfs_trans *tp, int flags, 174 174 struct xfs_buf **agfbpp); 175 - int xfs_alloc_read_agfl(struct xfs_mount *mp, struct xfs_trans *tp, 176 - xfs_agnumber_t agno, struct xfs_buf **bpp); 175 + int xfs_alloc_read_agfl(struct xfs_perag *pag, struct xfs_trans *tp, 176 + struct xfs_buf **bpp); 177 177 int xfs_free_agfl_block(struct xfs_trans *, xfs_agnumber_t, xfs_agblock_t, 178 178 struct xfs_buf *, struct xfs_owner_info *); 179 179 int xfs_alloc_fix_freelist(struct xfs_alloc_arg *args, int flags);
+1 -1
fs/xfs/scrub/agheader_repair.c
··· 405 405 * btrees rooted in the AGF. If the AGFL contents are obviously bad 406 406 * then we'll bail out. 407 407 */ 408 - error = xfs_alloc_read_agfl(mp, sc->tp, sc->sa.pag->pag_agno, &agfl_bp); 408 + error = xfs_alloc_read_agfl(sc->sa.pag, sc->tp, &agfl_bp); 409 409 if (error) 410 410 return error; 411 411
+1 -1
fs/xfs/scrub/common.c
··· 424 424 if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGF)) 425 425 return error; 426 426 427 - error = xfs_alloc_read_agfl(mp, sc->tp, agno, &sa->agfl_bp); 427 + error = xfs_alloc_read_agfl(sa->pag, sc->tp, &sa->agfl_bp); 428 428 if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGFL)) 429 429 return error; 430 430