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 4/6] btrfs: tracepoints: Fix qgroup reservation type printing
Date: Fri, 19 Jun 2020 15:24:49 +0300	[thread overview]
Message-ID: <20200619122451.31162-5-nborisov@suse.com> (raw)
In-Reply-To: <20200619122451.31162-1-nborisov@suse.com>

Since qgroup's reservation types are define in a macro they must be
exported to user space in order for user space tools to convert raw
binary data to symbolic names. Currently trace-cmd report produces
the following output:

kworker/u8:2-459   [003]  1208.543587: qgroup_update_reserve:
2b742cae-e0e5-4def-9ef7-28a9b34a951e: qgid=5 type=0x2 cur_reserved=54870016 diff=-32768

With this fix the output is:

kworker/u8:2-459   [003]  1208.543587: qgroup_update_reserve:
2b742cae-e0e5-4def-9ef7-28a9b34a951e: qgid=5 type=BTRFS_QGROUP_RSV_META_PREALLOC cur_reserved=54870016 diff=-32768

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

diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index e13c25598057..e6881ad5550a 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -78,6 +78,11 @@ TRACE_DEFINE_ENUM(COMMIT_TRANS);
 	EM (BTRFS_FILE_EXTENT_REG,		"REG")		\
 	EMe (BTRFS_FILE_EXTENT_PREALLOC,	"PREALLOC")
 
+#define QGROUP_RSV_TYPES					\
+	EM( BTRFS_QGROUP_RSV_DATA,	  "DATA"	)	\
+	EM( BTRFS_QGROUP_RSV_META_PERTRANS, "META_PERTRANS")	\
+	EMe( BTRFS_QGROUP_RSV_META_PREALLOC, "META_PREALLOC")
+
 #undef EM
 #undef EMe
 #define EM(a, b) TRACE_DEFINE_ENUM(a);
@@ -85,6 +90,7 @@ TRACE_DEFINE_ENUM(COMMIT_TRANS);
 
 FLUSH_ACTIONS
 FI_TYPES
+QGROUP_RSV_TYPES
 
 #undef EM
 #undef EMe
@@ -92,13 +98,6 @@ FI_TYPES
 #define EM(a, b)        {a, b},
 #define EMe(a, b)       {a, b}
 
-
-#define show_qgroup_rsv_type(type)					\
-	__print_symbolic(type,						\
-		{ BTRFS_QGROUP_RSV_DATA,	  "DATA"	},	\
-		{ BTRFS_QGROUP_RSV_META_PERTRANS, "META_PERTRANS" },	\
-		{ BTRFS_QGROUP_RSV_META_PREALLOC, "META_PREALLOC" })
-
 #define show_extent_io_tree_owner(owner)				       \
 	__print_symbolic(owner,						       \
 		{ IO_TREE_FS_PINNED_EXTENTS, 	  "PINNED_EXTENTS" },	       \
@@ -1704,7 +1703,7 @@ TRACE_EVENT(qgroup_update_reserve,
 	),
 
 	TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld",
-		__entry->qgid, show_qgroup_rsv_type(__entry->type),
+		__entry->qgid, __print_symbolic(__entry->type, QGROUP_RSV_TYPES),
 		__entry->cur_reserved, __entry->diff)
 );
 
@@ -1728,7 +1727,7 @@ TRACE_EVENT(qgroup_meta_reserve,
 
 	TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld",
 		show_root_type(__entry->refroot),
-		show_qgroup_rsv_type(__entry->type), __entry->diff)
+		__print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff)
 );
 
 TRACE_EVENT(qgroup_meta_convert,
@@ -1749,8 +1748,8 @@ TRACE_EVENT(qgroup_meta_convert,
 
 	TP_printk_btrfs("refroot=%llu(%s) type=%s->%s diff=%lld",
 		show_root_type(__entry->refroot),
-		show_qgroup_rsv_type(BTRFS_QGROUP_RSV_META_PREALLOC),
-		show_qgroup_rsv_type(BTRFS_QGROUP_RSV_META_PERTRANS),
+		__print_symbolic(BTRFS_QGROUP_RSV_META_PREALLOC, QGROUP_RSV_TYPES),
+		__print_symbolic(BTRFS_QGROUP_RSV_META_PERTRANS, QGROUP_RSV_TYPES),
 		__entry->diff)
 );
 
@@ -1776,7 +1775,7 @@ TRACE_EVENT(qgroup_meta_free_all_pertrans,
 
 	TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld",
 		show_root_type(__entry->refroot),
-		show_qgroup_rsv_type(__entry->type), __entry->diff)
+		__print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff)
 );
 
 DECLARE_EVENT_CLASS(btrfs__prelim_ref,
-- 
2.17.1


  parent reply	other threads:[~2020-06-19 12:26 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 ` [PATCH 2/6] btrfs: tracepoints: Fix extent type symbolic name print Nikolay Borisov
2020-06-19 12:24 ` [PATCH 3/6] btrfs: tracepoints: Move FLUSH_ACTIONS define Nikolay Borisov
2020-06-19 12:24 ` Nikolay Borisov [this message]
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-5-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.