Skip to content

Commit cec7bb7

Browse files
Dave Chinnerdchinner
authored andcommitted
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>
1 parent 8c392eb commit cec7bb7

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

fs/xfs/libxfs/xfs_alloc.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -703,20 +703,19 @@ const struct xfs_buf_ops xfs_agfl_buf_ops = {
703703
/*
704704
* Read in the allocation group free block array.
705705
*/
706-
int /* error */
706+
int
707707
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)
712711
{
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;
715715

716-
ASSERT(agno != NULLAGNUMBER);
717716
error = xfs_trans_read_buf(
718717
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)),
720719
XFS_FSS_TO_BB(mp, 1), 0, &bp, &xfs_agfl_buf_ops);
721720
if (error)
722721
return error;
@@ -2713,7 +2712,7 @@ xfs_alloc_fix_freelist(
27132712
targs.alignment = targs.minlen = targs.prod = 1;
27142713
targs.type = XFS_ALLOCTYPE_THIS_AG;
27152714
targs.pag = pag;
2716-
error = xfs_alloc_read_agfl(mp, tp, targs.agno, &agflbp);
2715+
error = xfs_alloc_read_agfl(pag, tp, &agflbp);
27172716
if (error)
27182717
goto out_agbp_relse;
27192718

@@ -2792,8 +2791,7 @@ xfs_alloc_get_freelist(
27922791
/*
27932792
* Read the array of free blocks.
27942793
*/
2795-
error = xfs_alloc_read_agfl(mp, tp, be32_to_cpu(agf->agf_seqno),
2796-
&agflbp);
2794+
error = xfs_alloc_read_agfl(pag, tp, &agflbp);
27972795
if (error)
27982796
return error;
27992797

@@ -2887,9 +2885,12 @@ xfs_alloc_put_freelist(
28872885
__be32 *agfl_bno;
28882886
int startoff;
28892887

2890-
if (!agflbp && (error = xfs_alloc_read_agfl(mp, tp,
2891-
be32_to_cpu(agf->agf_seqno), &agflbp)))
2892-
return error;
2888+
if (!agflbp) {
2889+
error = xfs_alloc_read_agfl(pag, tp, &agflbp);
2890+
if (error)
2891+
return error;
2892+
}
2893+
28932894
be32_add_cpu(&agf->agf_fllast, 1);
28942895
if (be32_to_cpu(agf->agf_fllast) == xfs_agfl_size(mp))
28952896
agf->agf_fllast = 0;

fs/xfs/libxfs/xfs_alloc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ int xfs_read_agf(struct xfs_perag *pag, struct xfs_trans *tp, int flags,
172172
struct xfs_buf **agfbpp);
173173
int xfs_alloc_read_agf(struct xfs_perag *pag, struct xfs_trans *tp, int flags,
174174
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);
177177
int xfs_free_agfl_block(struct xfs_trans *, xfs_agnumber_t, xfs_agblock_t,
178178
struct xfs_buf *, struct xfs_owner_info *);
179179
int xfs_alloc_fix_freelist(struct xfs_alloc_arg *args, int flags);

fs/xfs/scrub/agheader_repair.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ xrep_agf(
405405
* btrees rooted in the AGF. If the AGFL contents are obviously bad
406406
* then we'll bail out.
407407
*/
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);
409409
if (error)
410410
return error;
411411

fs/xfs/scrub/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ xchk_ag_read_headers(
424424
if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGF))
425425
return error;
426426

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);
428428
if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGFL))
429429
return error;
430430

0 commit comments

Comments
 (0)