]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: clean up bmap log intent item tracepoint callsites
authorDarrick J. Wong <djwong@kernel.org>
Thu, 22 Feb 2024 20:43:53 +0000 (12:43 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 22 Feb 2024 20:43:53 +0000 (12:43 -0800)
Pass the incore bmap structure to the tracepoints instead of open-coding
the argument passing.

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

index 06e329221cd52e155b37194bbbce8a4726613c6e..b90a903052165c183c117ee4fbe8b9ef084b0d25 100644 (file)
@@ -6191,15 +6191,6 @@ __xfs_bmap_add(
 {
        struct xfs_bmap_intent          *bi;
 
-       trace_xfs_bmap_defer(tp->t_mountp,
-                       XFS_FSB_TO_AGNO(tp->t_mountp, bmap->br_startblock),
-                       type,
-                       XFS_FSB_TO_AGBNO(tp->t_mountp, bmap->br_startblock),
-                       ip->i_ino, whichfork,
-                       bmap->br_startoff,
-                       bmap->br_blockcount,
-                       bmap->br_state);
-
        bi = kmem_cache_alloc(xfs_bmap_intent_cache, GFP_KERNEL | __GFP_NOFAIL);
        INIT_LIST_HEAD(&bi->bi_list);
        bi->bi_type = type;
@@ -6207,6 +6198,8 @@ __xfs_bmap_add(
        bi->bi_whichfork = whichfork;
        bi->bi_bmap = *bmap;
 
+       trace_xfs_bmap_defer(bi);
+
        xfs_bmap_update_get_group(tp->t_mountp, bi);
        xfs_defer_add(tp, &bi->bi_list, &xfs_bmap_update_defer_type);
        return 0;
@@ -6252,13 +6245,7 @@ xfs_bmap_finish_one(
 
        ASSERT(tp->t_highest_agno == NULLAGNUMBER);
 
-       trace_xfs_bmap_deferred(tp->t_mountp,
-                       XFS_FSB_TO_AGNO(tp->t_mountp, bmap->br_startblock),
-                       bi->bi_type,
-                       XFS_FSB_TO_AGBNO(tp->t_mountp, bmap->br_startblock),
-                       bi->bi_owner->i_ino, bi->bi_whichfork,
-                       bmap->br_startoff, bmap->br_blockcount,
-                       bmap->br_state);
+       trace_xfs_bmap_deferred(bi);
 
        if (WARN_ON_ONCE(bi->bi_whichfork != XFS_DATA_FORK)) {
                xfs_bmap_mark_sick(bi->bi_owner, bi->bi_whichfork);
index 10b85865204d6792b6e3cd2057f0c9b03f22cf43..0a2fd9304d1c50617d3049887cb205ac5e19de86 100644 (file)
@@ -232,6 +232,10 @@ enum xfs_bmap_intent_type {
        XFS_BMAP_UNMAP,
 };
 
+#define XFS_BMAP_INTENT_STRINGS \
+       { XFS_BMAP_MAP,         "map" }, \
+       { XFS_BMAP_UNMAP,       "unmap" }
+
 struct xfs_bmap_intent {
        struct list_head                        bi_list;
        enum xfs_bmap_intent_type               bi_type;
index 3f253884fe5b107a3d01ee39c2d657d9fbf944c0..1a963382e5e9e6a8272828bdf8c231bc77fe9159 100644 (file)
@@ -38,6 +38,7 @@
 #include "xfs_iomap.h"
 #include "xfs_buf_mem.h"
 #include "xfs_btree_mem.h"
+#include "xfs_bmap.h"
 
 /*
  * We include this last to have the helpers above available for the trace
index 5c16a88852e394c175931fc5e5682bdf155d97e1..2027ab56a1d85b63970fedb3dc114d93732c9a99 100644 (file)
@@ -81,6 +81,7 @@ struct xfs_icwalk;
 struct xfs_perag;
 struct xfbtree;
 struct xfs_btree_ops;
+struct xfs_bmap_intent;
 
 #define XFS_ATTR_FILTER_FLAGS \
        { XFS_ATTR_ROOT,        "ROOT" }, \
@@ -2946,16 +2947,12 @@ DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
 DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
 
 /* deferred bmbt updates */
+TRACE_DEFINE_ENUM(XFS_BMAP_MAP);
+TRACE_DEFINE_ENUM(XFS_BMAP_UNMAP);
+
 DECLARE_EVENT_CLASS(xfs_bmap_deferred_class,
-       TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
-                int op,
-                xfs_agblock_t agbno,
-                xfs_ino_t ino,
-                int whichfork,
-                xfs_fileoff_t offset,
-                xfs_filblks_t len,
-                xfs_exntst_t state),
-       TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
+       TP_PROTO(struct xfs_bmap_intent *bi),
+       TP_ARGS(bi),
        TP_STRUCT__entry(
                __field(dev_t, dev)
                __field(xfs_agnumber_t, agno)
@@ -2968,22 +2965,26 @@ DECLARE_EVENT_CLASS(xfs_bmap_deferred_class,
                __field(int, op)
        ),
        TP_fast_assign(
-               __entry->dev = mp->m_super->s_dev;
-               __entry->agno = agno;
-               __entry->ino = ino;
-               __entry->agbno = agbno;
-               __entry->whichfork = whichfork;
-               __entry->l_loff = offset;
-               __entry->l_len = len;
-               __entry->l_state = state;
-               __entry->op = op;
-       ),
-       TP_printk("dev %d:%d op %d agno 0x%x agbno 0x%x owner 0x%llx %s fileoff 0x%llx fsbcount 0x%llx state %d",
+               struct xfs_inode        *ip = bi->bi_owner;
+
+               __entry->dev = ip->i_mount->m_super->s_dev;
+               __entry->agno = XFS_FSB_TO_AGNO(ip->i_mount,
+                                       bi->bi_bmap.br_startblock);
+               __entry->ino = ip->i_ino;
+               __entry->agbno = XFS_FSB_TO_AGBNO(ip->i_mount,
+                                       bi->bi_bmap.br_startblock);
+               __entry->whichfork = bi->bi_whichfork;
+               __entry->l_loff = bi->bi_bmap.br_startoff;
+               __entry->l_len = bi->bi_bmap.br_blockcount;
+               __entry->l_state = bi->bi_bmap.br_state;
+               __entry->op = bi->bi_type;
+       ),
+       TP_printk("dev %d:%d op %s ino 0x%llx agno 0x%x agbno 0x%x %s fileoff 0x%llx fsbcount 0x%llx state %d",
                  MAJOR(__entry->dev), MINOR(__entry->dev),
-                 __entry->op,
+                 __print_symbolic(__entry->op, XFS_BMAP_INTENT_STRINGS),
+                 __entry->ino,
                  __entry->agno,
                  __entry->agbno,
-                 __entry->ino,
                  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
                  __entry->l_loff,
                  __entry->l_len,
@@ -2991,15 +2992,8 @@ DECLARE_EVENT_CLASS(xfs_bmap_deferred_class,
 );
 #define DEFINE_BMAP_DEFERRED_EVENT(name) \
 DEFINE_EVENT(xfs_bmap_deferred_class, name, \
-       TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
-                int op, \
-                xfs_agblock_t agbno, \
-                xfs_ino_t ino, \
-                int whichfork, \
-                xfs_fileoff_t offset, \
-                xfs_filblks_t len, \
-                xfs_exntst_t state), \
-       TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
+       TP_PROTO(struct xfs_bmap_intent *bi), \
+       TP_ARGS(bi))
 DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
 DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);