Skip to content

Commit 972016c

Browse files
committed
btrfs: simplify internal btrfs_printk helpers
The printk() can be compiled out depending on CONFIG_PRINTK, this is reflected in our helpers. The indirection is provided by btrfs_printk() used in the ratelimited and RCU wrapper macros. Drop the btrfs_printk() helper and define the ratelimit and RCU helpers directly when CONFIG_PRINTK is undefined. This will allow further changes to the _btrfs_printk() interface (which is internal), any message in other code should use the level-specific helpers. Signed-off-by: David Sterba <dsterba@suse.com>
1 parent ba8662c commit 972016c

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

fs/btrfs/messages.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ void btrfs_no_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...)
2323

2424
#ifdef CONFIG_PRINTK
2525

26-
#define btrfs_printk(fs_info, fmt, args...) \
27-
_btrfs_printk(fs_info, fmt, ##args)
28-
2926
__printf(2, 3)
3027
__cold
3128
void _btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...);
@@ -34,6 +31,13 @@ void _btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...);
3431

3532
#define btrfs_printk(fs_info, fmt, args...) \
3633
btrfs_no_printk(fs_info, fmt, ##args)
34+
35+
#define btrfs_printk_in_rcu(fs_info, fmt, args...) \
36+
btrfs_no_printk(fs_info, fmt, ##args)
37+
38+
#define btrfs_printk_rl_in_rcu(fs_info, fmt, args...) \
39+
btrfs_no_printk(fs_info, fmt, ##args)
40+
3741
#endif
3842

3943
/*
@@ -78,10 +82,12 @@ void _btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...);
7882
#define btrfs_debug_rl(fs_info, fmt, args...) do { (void)(fs_info); } while(0)
7983
#endif
8084

85+
#ifdef CONFIG_PRINTK
86+
8187
#define btrfs_printk_in_rcu(fs_info, fmt, args...) \
8288
do { \
8389
rcu_read_lock(); \
84-
btrfs_printk(fs_info, fmt, ##args); \
90+
_btrfs_printk(fs_info, fmt, ##args); \
8591
rcu_read_unlock(); \
8692
} while (0)
8793

@@ -93,10 +99,12 @@ do { \
9399
\
94100
rcu_read_lock(); \
95101
if (__ratelimit(&_rs)) \
96-
btrfs_printk(fs_info, fmt, ##args); \
102+
_btrfs_printk(fs_info, fmt, ##args); \
97103
rcu_read_unlock(); \
98104
} while (0)
99105

106+
#endif
107+
100108
#ifdef CONFIG_BTRFS_ASSERT
101109

102110
__printf(1, 2)

0 commit comments

Comments
 (0)