Skip to content

Commit fa044ae

Browse files
Dave Chinnerdchinner
authored andcommitted
xfs: pass perag to xfs_read_agf
We have the perag in most places we call xfs_read_agf, 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 61021de commit fa044ae

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

fs/xfs/libxfs/xfs_alloc.c

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3051,27 +3051,25 @@ const struct xfs_buf_ops xfs_agf_buf_ops = {
30513051
/*
30523052
* Read in the allocation group header (free/alloc section).
30533053
*/
3054-
int /* error */
3054+
int
30553055
xfs_read_agf(
3056-
struct xfs_mount *mp, /* mount point structure */
3057-
struct xfs_trans *tp, /* transaction pointer */
3058-
xfs_agnumber_t agno, /* allocation group number */
3059-
int flags, /* XFS_BUF_ */
3060-
struct xfs_buf **bpp) /* buffer for the ag freelist header */
3056+
struct xfs_perag *pag,
3057+
struct xfs_trans *tp,
3058+
int flags,
3059+
struct xfs_buf **agfbpp)
30613060
{
3062-
int error;
3061+
struct xfs_mount *mp = pag->pag_mount;
3062+
int error;
30633063

3064-
trace_xfs_read_agf(mp, agno);
3064+
trace_xfs_read_agf(pag->pag_mount, pag->pag_agno);
30653065

3066-
ASSERT(agno != NULLAGNUMBER);
30673066
error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
3068-
XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)),
3069-
XFS_FSS_TO_BB(mp, 1), flags, bpp, &xfs_agf_buf_ops);
3067+
XFS_AG_DADDR(mp, pag->pag_agno, XFS_AGF_DADDR(mp)),
3068+
XFS_FSS_TO_BB(mp, 1), flags, agfbpp, &xfs_agf_buf_ops);
30703069
if (error)
30713070
return error;
30723071

3073-
ASSERT(!(*bpp)->b_error);
3074-
xfs_buf_set_ref(*bpp, XFS_AGF_REF);
3072+
xfs_buf_set_ref(*agfbpp, XFS_AGF_REF);
30753073
return 0;
30763074
}
30773075

@@ -3097,7 +3095,7 @@ xfs_alloc_read_agf(
30973095
/* We don't support trylock when freeing. */
30983096
ASSERT((flags & (XFS_ALLOC_FLAG_FREEING | XFS_ALLOC_FLAG_TRYLOCK)) !=
30993097
(XFS_ALLOC_FLAG_FREEING | XFS_ALLOC_FLAG_TRYLOCK));
3100-
error = xfs_read_agf(pag->pag_mount, tp, pag->pag_agno,
3098+
error = xfs_read_agf(pag, tp,
31013099
(flags & XFS_ALLOC_FLAG_TRYLOCK) ? XBF_TRYLOCK : 0,
31023100
&agfbp);
31033101
if (error)

fs/xfs/libxfs/xfs_alloc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ xfs_alloc_get_rec(
185185
xfs_extlen_t *len, /* output: length of extent */
186186
int *stat); /* output: success/failure */
187187

188-
int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp,
189-
xfs_agnumber_t agno, int flags, struct xfs_buf **bpp);
188+
int xfs_read_agf(struct xfs_perag *pag, struct xfs_trans *tp, int flags,
189+
struct xfs_buf **agfbpp);
190190
int xfs_alloc_read_agf(struct xfs_perag *pag, struct xfs_trans *tp, int flags,
191191
struct xfs_buf **agfbpp);
192192
int xfs_alloc_read_agfl(struct xfs_mount *mp, struct xfs_trans *tp,

0 commit comments

Comments
 (0)