xfs: remove the agno argument to xfs_free_ag_extent
authorChristoph Hellwig <hch@lst.de>
Mon, 4 Nov 2024 04:18:27 +0000 (20:18 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 5 Nov 2024 21:38:24 +0000 (13:38 -0800)
xfs_free_ag_extent already has a pointer to the pag structure through
the agf buffer.  Use that instead of passing the redundant argument,
and do the same for the tracepoint.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
fs/xfs/libxfs/xfs_alloc.c
fs/xfs/libxfs/xfs_alloc.h
fs/xfs/xfs_extfree_item.c
fs/xfs/xfs_trace.h

index 22bdbb3e9980c414c4a6e17f47b06f9965ecf45c..59a240b946284474fbca3bd2c933d7ad5cafd87c 100644 (file)
@@ -2037,7 +2037,6 @@ int
 xfs_free_ag_extent(
        struct xfs_trans                *tp,
        struct xfs_buf                  *agbp,
-       xfs_agnumber_t                  agno,
        xfs_agblock_t                   bno,
        xfs_extlen_t                    len,
        const struct xfs_owner_info     *oinfo,
@@ -2358,19 +2357,19 @@ xfs_free_ag_extent(
         * Update the freespace totals in the ag and superblock.
         */
        error = xfs_alloc_update_counters(tp, agbp, len);
-       xfs_ag_resv_free_extent(agbp->b_pag, type, tp, len);
+       xfs_ag_resv_free_extent(pag, type, tp, len);
        if (error)
                goto error0;
 
        XFS_STATS_INC(mp, xs_freex);
        XFS_STATS_ADD(mp, xs_freeb, len);
 
-       trace_xfs_free_extent(mp, agno, bno, len, type, haveleft, haveright);
+       trace_xfs_free_extent(pag, bno, len, type, haveleft, haveright);
 
        return 0;
 
  error0:
-       trace_xfs_free_extent(mp, agno, bno, len, type, -1, -1);
+       trace_xfs_free_extent(pag, bno, len, type, -1, -1);
        if (bno_cur)
                xfs_btree_del_cursor(bno_cur, XFS_BTREE_ERROR);
        if (cnt_cur)
@@ -4012,8 +4011,7 @@ __xfs_free_extent(
                goto err_release;
        }
 
-       error = xfs_free_ag_extent(tp, agbp, pag->pag_agno, agbno, len, oinfo,
-                       type);
+       error = xfs_free_ag_extent(tp, agbp, agbno, len, oinfo, type);
        if (error)
                goto err_release;
 
index 0165452e7cd05593e60450fdcc59dd0cb9287422..88fbce5001185f8e920d6e696360a9d105e2fd21 100644 (file)
@@ -79,9 +79,8 @@ int xfs_alloc_put_freelist(struct xfs_perag *pag, struct xfs_trans *tp,
                struct xfs_buf *agfbp, struct xfs_buf *agflbp,
                xfs_agblock_t bno, int btreeblk);
 int xfs_free_ag_extent(struct xfs_trans *tp, struct xfs_buf *agbp,
-               xfs_agnumber_t agno, xfs_agblock_t bno,
-               xfs_extlen_t len, const struct xfs_owner_info *oinfo,
-               enum xfs_ag_resv_type type);
+               xfs_agblock_t bno, xfs_extlen_t len,
+               const struct xfs_owner_info *oinfo, enum xfs_ag_resv_type type);
 
 /*
  * Compute and fill in value of m_alloc_maxlevels.
index abffc74a924f77445d2573628e5c836622ee4ff6..7f1be08dbc1123dc1ad10b6ac916e5f6e2b1ef79 100644 (file)
@@ -547,8 +547,8 @@ xfs_agfl_free_finish_item(
 
        error = xfs_alloc_read_agf(xefi->xefi_pag, tp, 0, &agbp);
        if (!error)
-               error = xfs_free_ag_extent(tp, agbp, xefi->xefi_pag->pag_agno,
-                               agbno, 1, &oinfo, XFS_AG_RESV_AGFL);
+               error = xfs_free_ag_extent(tp, agbp, agbno, 1, &oinfo,
+                               XFS_AG_RESV_AGFL);
 
        xfs_efd_add_extent(efdp, xefi);
        xfs_extent_free_cancel_item(&xefi->xefi_list);
index fcb2bad4f76e4b5b71649b3dfcd484e8ca6c618f..b9baafba031b2531505efca63bd5ec4858d49ceb 100644 (file)
@@ -1758,10 +1758,9 @@ DEFINE_AGF_EVENT(xfs_agf);
 DEFINE_AGF_EVENT(xfs_agfl_reset);
 
 TRACE_EVENT(xfs_free_extent,
-       TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
-                xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
-                int haveright),
-       TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
+       TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len,
+                enum xfs_ag_resv_type resv, int haveleft, int haveright),
+       TP_ARGS(pag, agbno, len, resv, haveleft, haveright),
        TP_STRUCT__entry(
                __field(dev_t, dev)
                __field(xfs_agnumber_t, agno)
@@ -1772,8 +1771,8 @@ TRACE_EVENT(xfs_free_extent,
                __field(int, haveright)
        ),
        TP_fast_assign(
-               __entry->dev = mp->m_super->s_dev;
-               __entry->agno = agno;
+               __entry->dev = pag->pag_mount->m_super->s_dev;
+               __entry->agno = pag->pag_agno;
                __entry->agbno = agbno;
                __entry->len = len;
                __entry->resv = resv;