]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: simplify the xfs_rmap_{alloc,free}_extent calling conventions
authorDarrick J. Wong <djwong@kernel.org>
Tue, 15 Oct 2024 19:39:45 +0000 (12:39 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 5 Nov 2024 21:36:22 +0000 (13:36 -0800)
Simplify the calling conventions by allowing callers to pass a fsbno
(xfs_fsblock_t) directly into these functions, since we're just going to
set it in a struct anyway.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
fs/xfs/libxfs/xfs_refcount.c
fs/xfs/libxfs/xfs_rmap.c
fs/xfs/libxfs/xfs_rmap.h
fs/xfs/scrub/alloc_repair.c

index 2dbab68b4fe69fc6c03566070359b8da593e5d0f..26d3d7956e069d39a0c2f6a55539b0fb0e4f84f0 100644 (file)
@@ -1831,8 +1831,7 @@ xfs_refcount_alloc_cow_extent(
        __xfs_refcount_add(tp, XFS_REFCOUNT_ALLOC_COW, fsb, len);
 
        /* Add rmap entry */
-       xfs_rmap_alloc_extent(tp, XFS_FSB_TO_AGNO(mp, fsb),
-                       XFS_FSB_TO_AGBNO(mp, fsb), len, XFS_RMAP_OWN_COW);
+       xfs_rmap_alloc_extent(tp, fsb, len, XFS_RMAP_OWN_COW);
 }
 
 /* Forget a CoW staging event in the refcount btree. */
@@ -1848,8 +1847,7 @@ xfs_refcount_free_cow_extent(
                return;
 
        /* Remove rmap entry */
-       xfs_rmap_free_extent(tp, XFS_FSB_TO_AGNO(mp, fsb),
-                       XFS_FSB_TO_AGBNO(mp, fsb), len, XFS_RMAP_OWN_COW);
+       xfs_rmap_free_extent(tp, fsb, len, XFS_RMAP_OWN_COW);
        __xfs_refcount_add(tp, XFS_REFCOUNT_FREE_COW, fsb, len);
 }
 
index d0df68dc31318522e3bf6a89d35ec8f4f377b76f..57dbf99ce004530f5c5a30b4a507a45f962dfff2 100644 (file)
@@ -525,7 +525,7 @@ xfs_rmap_free_check_owner(
        struct xfs_btree_cur    *cur,
        uint64_t                ltoff,
        struct xfs_rmap_irec    *rec,
-       xfs_filblks_t           len,
+       xfs_extlen_t            len,
        uint64_t                owner,
        uint64_t                offset,
        unsigned int            flags)
@@ -2729,8 +2729,7 @@ xfs_rmap_convert_extent(
 void
 xfs_rmap_alloc_extent(
        struct xfs_trans        *tp,
-       xfs_agnumber_t          agno,
-       xfs_agblock_t           bno,
+       xfs_fsblock_t           fsbno,
        xfs_extlen_t            len,
        uint64_t                owner)
 {
@@ -2739,7 +2738,7 @@ xfs_rmap_alloc_extent(
        if (!xfs_rmap_update_is_needed(tp->t_mountp, XFS_DATA_FORK))
                return;
 
-       bmap.br_startblock = XFS_AGB_TO_FSB(tp->t_mountp, agno, bno);
+       bmap.br_startblock = fsbno;
        bmap.br_blockcount = len;
        bmap.br_startoff = 0;
        bmap.br_state = XFS_EXT_NORM;
@@ -2751,8 +2750,7 @@ xfs_rmap_alloc_extent(
 void
 xfs_rmap_free_extent(
        struct xfs_trans        *tp,
-       xfs_agnumber_t          agno,
-       xfs_agblock_t           bno,
+       xfs_fsblock_t           fsbno,
        xfs_extlen_t            len,
        uint64_t                owner)
 {
@@ -2761,7 +2759,7 @@ xfs_rmap_free_extent(
        if (!xfs_rmap_update_is_needed(tp->t_mountp, XFS_DATA_FORK))
                return;
 
-       bmap.br_startblock = XFS_AGB_TO_FSB(tp->t_mountp, agno, bno);
+       bmap.br_startblock = fsbno;
        bmap.br_blockcount = len;
        bmap.br_startoff = 0;
        bmap.br_state = XFS_EXT_NORM;
index 96b4321d831007a64e5d4c050bd0707c3c6205c8..8e2657af038e9e6aae2be38b4c7b7564ce769e4a 100644 (file)
@@ -184,10 +184,10 @@ void xfs_rmap_unmap_extent(struct xfs_trans *tp, struct xfs_inode *ip,
 void xfs_rmap_convert_extent(struct xfs_mount *mp, struct xfs_trans *tp,
                struct xfs_inode *ip, int whichfork,
                struct xfs_bmbt_irec *imap);
-void xfs_rmap_alloc_extent(struct xfs_trans *tp, xfs_agnumber_t agno,
-               xfs_agblock_t bno, xfs_extlen_t len, uint64_t owner);
-void xfs_rmap_free_extent(struct xfs_trans *tp, xfs_agnumber_t agno,
-               xfs_agblock_t bno, xfs_extlen_t len, uint64_t owner);
+void xfs_rmap_alloc_extent(struct xfs_trans *tp, xfs_fsblock_t fsbno,
+               xfs_extlen_t len, uint64_t owner);
+void xfs_rmap_free_extent(struct xfs_trans *tp, xfs_fsblock_t fsbno,
+               xfs_extlen_t len, uint64_t owner);
 
 int xfs_rmap_finish_one(struct xfs_trans *tp, struct xfs_rmap_intent *ri,
                struct xfs_btree_cur **pcur);
index 0433363a90b6162404fc2dbc9d311263d37ab50a..11e1e5404fc6dc2e2595b4b127f1d33b834077fc 100644 (file)
@@ -542,8 +542,9 @@ xrep_abt_dispose_one(
 
        /* Add a deferred rmap for each extent we used. */
        if (resv->used > 0)
-               xfs_rmap_alloc_extent(sc->tp, pag_agno(pag), resv->agbno,
-                               resv->used, XFS_RMAP_OWN_AG);
+               xfs_rmap_alloc_extent(sc->tp,
+                               xfs_agbno_to_fsb(pag, resv->agbno), resv->used,
+                               XFS_RMAP_OWN_AG);
 
        /*
         * For each reserved btree block we didn't use, add it to the free