btrfs: implement btrfs_debug* in terms of helper macro
authorRasmus Villemoes <[email protected]>
Fri, 8 Mar 2019 00:28:00 +0000 (16:28 -0800)
committerLinus Torvalds <[email protected]>
Fri, 8 Mar 2019 02:32:00 +0000 (18:32 -0800)
First, the btrfs_debug macros open-code (one possible definition of)
DYNAMIC_DEBUG_BRANCH, so they don't benefit from the CONFIG_JUMP_LABEL
optimization.

Second, a planned change of struct _ddebug (to reduce its size on 64 bit
machines) requires that all descriptors in a translation unit use
distinct identifiers.

Using the new _dynamic_func_call_no_desc helper macro from
dynamic_debug.h takes care of both of these.  No functional change.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Rasmus Villemoes <[email protected]>
Acked-by: David Sterba <[email protected]>
Acked-by: Jason Baron <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Petr Mladek <[email protected]>
Cc: "Rafael J . Wysocki" <[email protected]>
Cc: Steven Rostedt <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/btrfs/ctree.h

index 7a2a2621f0d9d7402ab2bfc2b10d9421c96dbbb0..94618a028730578112d169c4468be610ed7d55c3 100644 (file)
@@ -3415,31 +3415,17 @@ void btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...);
 
 #if defined(CONFIG_DYNAMIC_DEBUG)
 #define btrfs_debug(fs_info, fmt, args...)                             \
-do {                                                                   \
-        DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);                \
-        if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT))         \
-               btrfs_printk(fs_info, KERN_DEBUG fmt, ##args);          \
-} while (0)
-#define btrfs_debug_in_rcu(fs_info, fmt, args...)                      \
-do {                                                                   \
-        DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);                \
-        if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT))                 \
-               btrfs_printk_in_rcu(fs_info, KERN_DEBUG fmt, ##args);   \
-} while (0)
+       _dynamic_func_call_no_desc(fmt, btrfs_printk,                   \
+                                  fs_info, KERN_DEBUG fmt, ##args)
+#define btrfs_debug_in_rcu(fs_info, fmt, args...)                      \
+       _dynamic_func_call_no_desc(fmt, btrfs_printk_in_rcu,            \
+                                  fs_info, KERN_DEBUG fmt, ##args)
 #define btrfs_debug_rl_in_rcu(fs_info, fmt, args...)                   \
-do {                                                                   \
-        DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);                \
-        if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT))         \
-               btrfs_printk_rl_in_rcu(fs_info, KERN_DEBUG fmt,         \
-                                      ##args);\
-} while (0)
-#define btrfs_debug_rl(fs_info, fmt, args...)                          \
-do {                                                                   \
-        DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);                \
-        if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT))         \
-               btrfs_printk_ratelimited(fs_info, KERN_DEBUG fmt,       \
-                                        ##args);                       \
-} while (0)
+       _dynamic_func_call_no_desc(fmt, btrfs_printk_rl_in_rcu,         \
+                                  fs_info, KERN_DEBUG fmt, ##args)
+#define btrfs_debug_rl(fs_info, fmt, args...)                          \
+       _dynamic_func_call_no_desc(fmt, btrfs_printk_ratelimited,       \
+                                  fs_info, KERN_DEBUG fmt, ##args)
 #elif defined(DEBUG)
 #define btrfs_debug(fs_info, fmt, args...) \
        btrfs_printk(fs_info, KERN_DEBUG fmt, ##args)