All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 2/6] btrfs: tracepoints: Fix extent type symbolic name print
Date: Fri, 19 Jun 2020 15:24:47 +0300	[thread overview]
Message-ID: <20200619122451.31162-3-nborisov@suse.com> (raw)
In-Reply-To: <20200619122451.31162-1-nborisov@suse.com>

extent's type is an enum and this requires that the enum values be
exported to user space so that user space tools can correctly map raw
binary data to the symbolic name. Currently tracepoints using
btrfs__file_extent_item_regular or btrfs__file_extent_item_inline result
in the following output:

fio-443   [002]   586.609450: btrfs_get_extent_show_fi_regular: f0c3bf8e-0174-4bcc-92aa-6c2d62430420:i
root=5(FS_TREE) inode=258 size=2136457216 disk_isize=0 i
file extent range=[2126946304 2136457216] (num_bytes=9510912
ram_bytes=9510912 disk_bytenr=0 disk_num_bytes=0 extent_offset=0
type=0x1 compression=0

E.g type is 0x1 . With this patch applie the output is:

<ommitted for brevity>  disk_bytenr=141348864 disk_num_bytes=4096 extent_offset=0 type=REG compression=0

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 include/trace/events/btrfs.h | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 2615c7181e8c..937519399f30 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -67,11 +67,24 @@ TRACE_DEFINE_ENUM(COMMIT_TRANS);
 	      (obj >= BTRFS_ROOT_TREE_OBJECTID &&			\
 	       obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
 
-#define show_fi_type(type)						\
-	__print_symbolic(type,						\
-		 { BTRFS_FILE_EXTENT_INLINE,	"INLINE" },		\
-		 { BTRFS_FILE_EXTENT_REG,	"REG"	 },		\
-		 { BTRFS_FILE_EXTENT_PREALLOC,	"PREALLOC"})
+#define FI_TYPES							\
+	EM (BTRFS_FILE_EXTENT_INLINE,		"INLINE")	\
+	EM (BTRFS_FILE_EXTENT_REG,		"REG")		\
+	EMe (BTRFS_FILE_EXTENT_PREALLOC,	"PREALLOC")
+
+#undef EM
+#undef EMe
+#define EM(a, b) TRACE_DEFINE_ENUM(a);
+#define EMe(a, b) TRACE_DEFINE_ENUM(a);
+
+FI_TYPES
+
+#undef EM
+#undef EMe
+
+#define EM(a, b)        {a, b},
+#define EMe(a, b)       {a, b}
+
 
 #define show_qgroup_rsv_type(type)					\
 	__print_symbolic(type,						\
@@ -380,7 +393,7 @@ DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular,
 		__entry->disk_isize, __entry->extent_start,
 		__entry->extent_end, __entry->num_bytes, __entry->ram_bytes,
 		__entry->disk_bytenr, __entry->disk_num_bytes,
-		__entry->extent_offset, show_fi_type(__entry->extent_type),
+		__entry->extent_offset, __print_symbolic(__entry->extent_type, FI_TYPES),
 		__entry->compression)
 );
 
@@ -421,7 +434,7 @@ DECLARE_EVENT_CLASS(
 		"extent_type=%s compression=%u",
 		show_root_type(__entry->root_obj), __entry->ino, __entry->isize,
 		__entry->disk_isize, __entry->extent_start,
-		__entry->extent_end, show_fi_type(__entry->extent_type),
+		__entry->extent_end, __print_symbolic(__entry->extent_type, FI_TYPES),
 		__entry->compression)
 );
 
-- 
2.17.1


  parent reply	other threads:[~2020-06-19 12:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 12:24 [PATCH 0/6] Fix enum values print in tracepoints Nikolay Borisov
2020-06-19 12:24 ` [PATCH 1/6] btrfs: tracepoints: Fix btrfs_trigger_flush printout Nikolay Borisov
2020-06-19 12:24 ` Nikolay Borisov [this message]
2020-06-19 12:24 ` [PATCH 3/6] btrfs: tracepoints: Move FLUSH_ACTIONS define Nikolay Borisov
2020-06-19 12:24 ` [PATCH 4/6] btrfs: tracepoints: Fix qgroup reservation type printing Nikolay Borisov
2020-06-19 12:24 ` [PATCH 5/6] btrfs: tracepoints: Switch extent_io_tree_owner to using EM macro Nikolay Borisov
2020-06-19 12:24 ` [PATCH 6/6] btrfs: tracepoints: Convert flush states to using EM macros Nikolay Borisov
2020-06-22 14:21 ` [PATCH 0/6] Fix enum values print in tracepoints David Sterba
2020-06-22 15:19   ` Nikolay Borisov
2020-06-22 16:05     ` David Sterba
2020-06-29 20:52 ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200619122451.31162-3-nborisov@suse.com \
    --to=nborisov@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.