]> 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>
Wed, 29 May 2024 04:11:46 +0000 (21:11 -0700)
committerChristoph Hellwig <hch@lst.de>
Mon, 12 Aug 2024 07:35:30 +0000 (09:35 +0200)
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 198b84117df138a6b4a75274ac241198aa5cfac7..37775284ca9a7b82a7e14856c2926b3776acb3a4 100644 (file)
@@ -1832,8 +1832,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. */
@@ -1849,8 +1848,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 6ef4687b3aba8fcf6aef22adb0e46db405507e61..8f730a7985901502ae0c0c8c886a986cf00feb16 100644 (file)
@@ -527,7 +527,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)
@@ -2727,8 +2727,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)
 {
@@ -2737,7 +2736,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;
@@ -2749,8 +2748,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)
 {
@@ -2759,7 +2757,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 b783dd4dd95d1abe73c4697f50fdd05efb11d518..90553434eb3fc85e10c466c3f7bbe72ba5097b21 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 30295898cc8a638b68aebd7bb525a582f2218d9f..6b8bbb8110ab5a4175ccfcfdac1b65a7304d0949 100644 (file)
@@ -542,9 +542,13 @@ xrep_abt_dispose_one(
        ASSERT(pag == resv->pag);
 
        /* Add a deferred rmap for each extent we used. */
-       if (resv->used > 0)
-               xfs_rmap_alloc_extent(sc->tp, pag->pag_agno, resv->agbno,
-                               resv->used, XFS_RMAP_OWN_AG);
+       if (resv->used > 0) {
+               xfs_fsblock_t   fsbno;
+
+               fsbno = XFS_AGB_TO_FSB(sc->mp, pag->pag_agno, resv->agbno);
+               xfs_rmap_alloc_extent(sc->tp, fsbno, resv->used,
+                               XFS_RMAP_OWN_AG);
+       }
 
        /*
         * For each reserved btree block we didn't use, add it to the free