Skip to content

Commit 49f0d84

Browse files
Dave Chinnerdchinner
authored andcommitted
xfs: pass perag to xfs_alloc_get_freelist
It's available in all callers, so pass it in so that the perag can be passed further down the stack. 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 fa044ae commit 49f0d84

File tree

5 files changed

+13
-22
lines changed

5 files changed

+13
-22
lines changed

fs/xfs/libxfs/xfs_alloc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,8 @@ xfs_alloc_ag_vextent_small(
10751075
be32_to_cpu(agf->agf_flcount) <= args->minleft)
10761076
goto out;
10771077

1078-
error = xfs_alloc_get_freelist(args->tp, args->agbp, &fbno, 0);
1078+
error = xfs_alloc_get_freelist(args->pag, args->tp, args->agbp,
1079+
&fbno, 0);
10791080
if (error)
10801081
goto error;
10811082
if (fbno == NULLAGBLOCK)
@@ -2697,7 +2698,7 @@ xfs_alloc_fix_freelist(
26972698
else
26982699
targs.oinfo = XFS_RMAP_OINFO_AG;
26992700
while (!(flags & XFS_ALLOC_FLAG_NOSHRINK) && pag->pagf_flcount > need) {
2700-
error = xfs_alloc_get_freelist(tp, agbp, &bno, 0);
2701+
error = xfs_alloc_get_freelist(pag, tp, agbp, &bno, 0);
27012702
if (error)
27022703
goto out_agbp_relse;
27032704

@@ -2767,6 +2768,7 @@ xfs_alloc_fix_freelist(
27672768
*/
27682769
int
27692770
xfs_alloc_get_freelist(
2771+
struct xfs_perag *pag,
27702772
struct xfs_trans *tp,
27712773
struct xfs_buf *agbp,
27722774
xfs_agblock_t *bnop,
@@ -2779,7 +2781,6 @@ xfs_alloc_get_freelist(
27792781
int error;
27802782
uint32_t logflags;
27812783
struct xfs_mount *mp = tp->t_mountp;
2782-
struct xfs_perag *pag;
27832784

27842785
/*
27852786
* Freelist is empty, give up.
@@ -2807,7 +2808,6 @@ xfs_alloc_get_freelist(
28072808
if (be32_to_cpu(agf->agf_flfirst) == xfs_agfl_size(mp))
28082809
agf->agf_flfirst = 0;
28092810

2810-
pag = agbp->b_pag;
28112811
ASSERT(!pag->pagf_agflreset);
28122812
be32_add_cpu(&agf->agf_flcount, -1);
28132813
pag->pagf_flcount--;

fs/xfs/libxfs/xfs_alloc.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ xfs_extlen_t xfs_alloc_longest_free_extent(struct xfs_perag *pag,
9595
xfs_extlen_t need, xfs_extlen_t reserved);
9696
unsigned int xfs_alloc_min_freelist(struct xfs_mount *mp,
9797
struct xfs_perag *pag);
98+
int xfs_alloc_get_freelist(struct xfs_perag *pag, struct xfs_trans *tp,
99+
struct xfs_buf *agfbp, xfs_agblock_t *bnop, int btreeblk);
98100

99101
/*
100102
* Compute and fill in value of m_alloc_maxlevels.
@@ -103,17 +105,6 @@ void
103105
xfs_alloc_compute_maxlevels(
104106
struct xfs_mount *mp); /* file system mount structure */
105107

106-
/*
107-
* Get a block from the freelist.
108-
* Returns with the buffer for the block gotten.
109-
*/
110-
int /* error */
111-
xfs_alloc_get_freelist(
112-
struct xfs_trans *tp, /* transaction pointer */
113-
struct xfs_buf *agbp, /* buffer containing the agf structure */
114-
xfs_agblock_t *bnop, /* block address retrieved from freelist */
115-
int btreeblk); /* destination is a AGF btree */
116-
117108
/*
118109
* Log the given fields from the agf structure.
119110
*/

fs/xfs/libxfs/xfs_alloc_btree.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ xfs_allocbt_alloc_block(
6060
xfs_agblock_t bno;
6161

6262
/* Allocate the new block from the freelist. If we can't, give up. */
63-
error = xfs_alloc_get_freelist(cur->bc_tp, cur->bc_ag.agbp,
64-
&bno, 1);
63+
error = xfs_alloc_get_freelist(cur->bc_ag.pag, cur->bc_tp,
64+
cur->bc_ag.agbp, &bno, 1);
6565
if (error)
6666
return error;
6767

@@ -71,7 +71,7 @@ xfs_allocbt_alloc_block(
7171
}
7272

7373
atomic64_inc(&cur->bc_mp->m_allocbt_blks);
74-
xfs_extent_busy_reuse(cur->bc_mp, cur->bc_ag.agbp->b_pag, bno, 1, false);
74+
xfs_extent_busy_reuse(cur->bc_mp, cur->bc_ag.pag, bno, 1, false);
7575

7676
new->s = cpu_to_be32(bno);
7777

fs/xfs/libxfs/xfs_rmap_btree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ xfs_rmapbt_alloc_block(
9090
xfs_agblock_t bno;
9191

9292
/* Allocate the new block from the freelist. If we can't, give up. */
93-
error = xfs_alloc_get_freelist(cur->bc_tp, cur->bc_ag.agbp,
93+
error = xfs_alloc_get_freelist(pag, cur->bc_tp, cur->bc_ag.agbp,
9494
&bno, 1);
9595
if (error)
9696
return error;

fs/xfs/scrub/repair.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,13 @@ xrep_alloc_ag_block(
300300
switch (resv) {
301301
case XFS_AG_RESV_AGFL:
302302
case XFS_AG_RESV_RMAPBT:
303-
error = xfs_alloc_get_freelist(sc->tp, sc->sa.agf_bp, &bno, 1);
303+
error = xfs_alloc_get_freelist(sc->sa.pag, sc->tp,
304+
sc->sa.agf_bp, &bno, 1);
304305
if (error)
305306
return error;
306307
if (bno == NULLAGBLOCK)
307308
return -ENOSPC;
308-
xfs_extent_busy_reuse(sc->mp, sc->sa.pag, bno,
309-
1, false);
309+
xfs_extent_busy_reuse(sc->mp, sc->sa.pag, bno, 1, false);
310310
*fsbno = XFS_AGB_TO_FSB(sc->mp, sc->sa.pag->pag_agno, bno);
311311
if (resv == XFS_AG_RESV_RMAPBT)
312312
xfs_ag_resv_rmapbt_alloc(sc->mp, sc->sa.pag->pag_agno);

0 commit comments

Comments
 (0)