xfs: resolve fork names in trace output
authorDarrick J. Wong <djwong@kernel.org>
Tue, 17 Aug 2021 20:09:26 +0000 (13:09 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 19 Aug 2021 17:07:10 +0000 (10:07 -0700)
Emit whichfork values as text strings in the ftrace output.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
fs/xfs/libxfs/xfs_types.h
fs/xfs/scrub/trace.h
fs/xfs/xfs_trace.h

index 0870ef6f933d0518ca7e236ec95e788689b17085..b6da06b40989fc1ff4f1c351ddacc775a1196f58 100644 (file)
@@ -87,6 +87,11 @@ typedef void *               xfs_failaddr_t;
 #define        XFS_ATTR_FORK   1
 #define        XFS_COW_FORK    2
 
+#define XFS_WHICHFORK_STRINGS \
+       { XFS_DATA_FORK,        "data" }, \
+       { XFS_ATTR_FORK,        "attr" }, \
+       { XFS_COW_FORK,         "cow" }
+
 /*
  * Min numbers of data/attr fork btree root pointers.
  */
index eb29f56dc9f18a70796d29632a98cb7b25c0b8ac..2385238b28a8081b9557ffb52c77c42288f91a28 100644 (file)
@@ -176,10 +176,10 @@ TRACE_EVENT(xchk_file_op_error,
                __entry->error = error;
                __entry->ret_ip = ret_ip;
        ),
-       TP_printk("dev %d:%d ino 0x%llx fork %d type %s fileoff 0x%llx error %d ret_ip %pS",
+       TP_printk("dev %d:%d ino 0x%llx fork %s type %s fileoff 0x%llx error %d ret_ip %pS",
                  MAJOR(__entry->dev), MINOR(__entry->dev),
                  __entry->ino,
-                 __entry->whichfork,
+                 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
                  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
                  __entry->offset,
                  __entry->error,
@@ -273,10 +273,10 @@ DECLARE_EVENT_CLASS(xchk_fblock_error_class,
                __entry->offset = offset;
                __entry->ret_ip = ret_ip;
        ),
-       TP_printk("dev %d:%d ino 0x%llx fork %d type %s fileoff 0x%llx ret_ip %pS",
+       TP_printk("dev %d:%d ino 0x%llx fork %s type %s fileoff 0x%llx ret_ip %pS",
                  MAJOR(__entry->dev), MINOR(__entry->dev),
                  __entry->ino,
-                 __entry->whichfork,
+                 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
                  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
                  __entry->offset,
                  __entry->ret_ip)
@@ -381,10 +381,10 @@ TRACE_EVENT(xchk_ifork_btree_op_error,
                __entry->error = error;
                __entry->ret_ip = ret_ip;
        ),
-       TP_printk("dev %d:%d ino 0x%llx fork %d type %s btree %s level %d ptr %d agno 0x%x agbno 0x%x error %d ret_ip %pS",
+       TP_printk("dev %d:%d ino 0x%llx fork %s type %s btree %s level %d ptr %d agno 0x%x agbno 0x%x error %d ret_ip %pS",
                  MAJOR(__entry->dev), MINOR(__entry->dev),
                  __entry->ino,
-                 __entry->whichfork,
+                 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
                  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
                  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
                  __entry->level,
@@ -460,10 +460,10 @@ TRACE_EVENT(xchk_ifork_btree_error,
                __entry->ptr = cur->bc_ptrs[level];
                __entry->ret_ip = ret_ip;
        ),
-       TP_printk("dev %d:%d ino 0x%llx fork %d type %s btree %s level %d ptr %d agno 0x%x agbno 0x%x ret_ip %pS",
+       TP_printk("dev %d:%d ino 0x%llx fork %s type %s btree %s level %d ptr %d agno 0x%x agbno 0x%x ret_ip %pS",
                  MAJOR(__entry->dev), MINOR(__entry->dev),
                  __entry->ino,
-                 __entry->whichfork,
+                 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
                  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
                  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
                  __entry->level,
index bb329b93d9bccfa356103744a3d298817264f443..2c19ca3d13e0cdd82bb2aba3493ca22768a2d407 100644 (file)
@@ -1446,7 +1446,7 @@ DECLARE_EVENT_CLASS(xfs_imap_class,
                  __entry->size,
                  __entry->offset,
                  __entry->count,
-                 __entry->whichfork == XFS_COW_FORK ? "cow" : "data",
+                 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
                  __entry->startoff,
                  (int64_t)__entry->startblock,
                  __entry->blockcount)
@@ -2614,7 +2614,7 @@ DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
                  __entry->agno,
                  __entry->agbno,
                  __entry->ino,
-                 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
+                 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
                  __entry->l_loff,
                  __entry->l_len,
                  __entry->l_state)
@@ -3859,7 +3859,7 @@ TRACE_EVENT(xfs_btree_commit_ifakeroot,
                  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
                  __entry->agno,
                  __entry->agino,
-                 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
+                 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
                  __entry->levels,
                  __entry->blocks)
 )