]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: pass rmap space mapping directly through the log intent code
authorDarrick J. Wong <djwong@kernel.org>
Tue, 2 May 2023 12:51:18 +0000 (14:51 +0200)
committerCarlos Maiolino <cem@kernel.org>
Tue, 9 May 2023 16:18:15 +0000 (18:18 +0200)
Source kernel commit: 1534328bb427f175e5de56c9af62f8f4675da595

Pass the incore rmap space mapping through the RUI logging code instead
of repeatedly boxing and unboxing parameters.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
libxfs/defer_item.c
libxfs/xfs_rmap.c
libxfs/xfs_rmap.h

index 8181a5d95e4d23394fb7423aef8f47e8f251cad8..56f44e3210112321db0b6f0dbc561f8f97662db6 100644 (file)
@@ -217,19 +217,12 @@ xfs_rmap_update_finish_item(
        struct list_head                *item,
        struct xfs_btree_cur            **state)
 {
-       struct xfs_rmap_intent          *rmap;
+       struct xfs_rmap_intent          *ri;
        int                             error;
 
-       rmap = container_of(item, struct xfs_rmap_intent, ri_list);
-       error = xfs_rmap_finish_one(tp,
-                       rmap->ri_type,
-                       rmap->ri_owner, rmap->ri_whichfork,
-                       rmap->ri_bmap.br_startoff,
-                       rmap->ri_bmap.br_startblock,
-                       rmap->ri_bmap.br_blockcount,
-                       rmap->ri_bmap.br_state,
-                       state);
-       kmem_cache_free(xfs_rmap_intent_cache, rmap);
+       ri = container_of(item, struct xfs_rmap_intent, ri_list);
+       error = xfs_rmap_finish_one(tp, ri, state);
+       kmem_cache_free(xfs_rmap_intent_cache, ri);
        return error;
 }
 
@@ -245,10 +238,10 @@ STATIC void
 xfs_rmap_update_cancel_item(
        struct list_head                *item)
 {
-       struct xfs_rmap_intent          *rmap;
+       struct xfs_rmap_intent          *ri;
 
-       rmap = container_of(item, struct xfs_rmap_intent, ri_list);
-       kmem_cache_free(xfs_rmap_intent_cache, rmap);
+       ri = container_of(item, struct xfs_rmap_intent, ri_list);
+       kmem_cache_free(xfs_rmap_intent_cache, ri);
 }
 
 const struct xfs_defer_op_type xfs_rmap_update_defer_type = {
index b3caff1da30c74dcfbd95ee4c81c43b39eeb8975..2f21b744dccc106a379f29d465283ec6d4e99c76 100644 (file)
@@ -2389,13 +2389,7 @@ xfs_rmap_finish_one_cleanup(
 int
 xfs_rmap_finish_one(
        struct xfs_trans                *tp,
-       enum xfs_rmap_intent_type       type,
-       uint64_t                        owner,
-       int                             whichfork,
-       xfs_fileoff_t                   startoff,
-       xfs_fsblock_t                   startblock,
-       xfs_filblks_t                   blockcount,
-       xfs_exntst_t                    state,
+       struct xfs_rmap_intent          *ri,
        struct xfs_btree_cur            **pcur)
 {
        struct xfs_mount                *mp = tp->t_mountp;
@@ -2407,11 +2401,13 @@ xfs_rmap_finish_one(
        xfs_agblock_t                   bno;
        bool                            unwritten;
 
-       pag = xfs_perag_get(mp, XFS_FSB_TO_AGNO(mp, startblock));
-       bno = XFS_FSB_TO_AGBNO(mp, startblock);
+       pag = xfs_perag_get(mp, XFS_FSB_TO_AGNO(mp, ri->ri_bmap.br_startblock));
+       bno = XFS_FSB_TO_AGBNO(mp, ri->ri_bmap.br_startblock);
 
-       trace_xfs_rmap_deferred(mp, pag->pag_agno, type, bno, owner, whichfork,
-                       startoff, blockcount, state);
+       trace_xfs_rmap_deferred(mp, pag->pag_agno, ri->ri_type, bno,
+                       ri->ri_owner, ri->ri_whichfork,
+                       ri->ri_bmap.br_startoff, ri->ri_bmap.br_blockcount,
+                       ri->ri_bmap.br_state);
 
        if (XFS_TEST_ERROR(false, mp, XFS_ERRTAG_RMAP_FINISH_ONE)) {
                error = -EIO;
@@ -2447,35 +2443,37 @@ xfs_rmap_finish_one(
        }
        *pcur = rcur;
 
-       xfs_rmap_ino_owner(&oinfo, owner, whichfork, startoff);
-       unwritten = state == XFS_EXT_UNWRITTEN;
-       bno = XFS_FSB_TO_AGBNO(rcur->bc_mp, startblock);
+       xfs_rmap_ino_owner(&oinfo, ri->ri_owner, ri->ri_whichfork,
+                       ri->ri_bmap.br_startoff);
+       unwritten = ri->ri_bmap.br_state == XFS_EXT_UNWRITTEN;
+       bno = XFS_FSB_TO_AGBNO(rcur->bc_mp, ri->ri_bmap.br_startblock);
 
-       switch (type) {
+       switch (ri->ri_type) {
        case XFS_RMAP_ALLOC:
        case XFS_RMAP_MAP:
-               error = xfs_rmap_map(rcur, bno, blockcount, unwritten, &oinfo);
+               error = xfs_rmap_map(rcur, bno, ri->ri_bmap.br_blockcount,
+                               unwritten, &oinfo);
                break;
        case XFS_RMAP_MAP_SHARED:
-               error = xfs_rmap_map_shared(rcur, bno, blockcount, unwritten,
-                               &oinfo);
+               error = xfs_rmap_map_shared(rcur, bno,
+                               ri->ri_bmap.br_blockcount, unwritten, &oinfo);
                break;
        case XFS_RMAP_FREE:
        case XFS_RMAP_UNMAP:
-               error = xfs_rmap_unmap(rcur, bno, blockcount, unwritten,
-                               &oinfo);
+               error = xfs_rmap_unmap(rcur, bno, ri->ri_bmap.br_blockcount,
+                               unwritten, &oinfo);
                break;
        case XFS_RMAP_UNMAP_SHARED:
-               error = xfs_rmap_unmap_shared(rcur, bno, blockcount, unwritten,
-                               &oinfo);
+               error = xfs_rmap_unmap_shared(rcur, bno,
+                               ri->ri_bmap.br_blockcount, unwritten, &oinfo);
                break;
        case XFS_RMAP_CONVERT:
-               error = xfs_rmap_convert(rcur, bno, blockcount, !unwritten,
-                               &oinfo);
+               error = xfs_rmap_convert(rcur, bno, ri->ri_bmap.br_blockcount,
+                               !unwritten, &oinfo);
                break;
        case XFS_RMAP_CONVERT_SHARED:
-               error = xfs_rmap_convert_shared(rcur, bno, blockcount,
-                               !unwritten, &oinfo);
+               error = xfs_rmap_convert_shared(rcur, bno,
+                               ri->ri_bmap.br_blockcount, !unwritten, &oinfo);
                break;
        default:
                ASSERT(0);
index 54741a591a17fe9c4e48886649fb21b48d8e8e8a..2dac88cea28dc4688ee76e1b47c8023db66be508 100644 (file)
@@ -179,10 +179,8 @@ void xfs_rmap_free_extent(struct xfs_trans *tp, xfs_agnumber_t agno,
 
 void xfs_rmap_finish_one_cleanup(struct xfs_trans *tp,
                struct xfs_btree_cur *rcur, int error);
-int xfs_rmap_finish_one(struct xfs_trans *tp, enum xfs_rmap_intent_type type,
-               uint64_t owner, int whichfork, xfs_fileoff_t startoff,
-               xfs_fsblock_t startblock, xfs_filblks_t blockcount,
-               xfs_exntst_t state, struct xfs_btree_cur **pcur);
+int xfs_rmap_finish_one(struct xfs_trans *tp, struct xfs_rmap_intent *ri,
+               struct xfs_btree_cur **pcur);
 
 int xfs_rmap_lookup_le_range(struct xfs_btree_cur *cur, xfs_agblock_t bno,
                uint64_t owner, uint64_t offset, unsigned int flags,