]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: simplify the xfs_rmap_{alloc,free}_extent calling conventions
authorDarrick J. Wong <djwong@kernel.org>
Mon, 24 Feb 2025 18:21:46 +0000 (10:21 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 25 Feb 2025 17:15:57 +0000 (09:15 -0800)
Source kernel commit: 953f76bf7a3622351f335c77c56ed7efb793e3e7

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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_refcount.c
libxfs/xfs_rmap.c
libxfs/xfs_rmap.h

index 709e2a94176da57e61e1727a5e5b6cc684bb24b3..11c0ca5ecdb3e40fbe30ced9bbb6dd2a364dec79 100644 (file)
@@ -1830,8 +1830,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. */
@@ -1847,8 +1846,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 dabc7003586ce4aff0667cd4552e28ee26c1e194..e23972f934f9efccbc990a729b8fcec7c830db67 100644 (file)
@@ -524,7 +524,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)
@@ -2728,8 +2728,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)
 {
@@ -2738,7 +2737,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;
@@ -2750,8 +2749,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)
 {
@@ -2760,7 +2758,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);