Skip to content

Commit b37cafa

Browse files
geertupmladek
authored andcommitted
ceph: Use no_printk() helper
When printk-indexing is enabled, each printk() invocation emits a pi_entry structure. This is even true when the call is protected by an always-false check: while the actual code to print the message is optimized out by the compiler, the pi_entry structure is still emitted. Fix this by replacing "if (0) printk(...)" constructs by calls to the no_printk() helper. This reduces the size of an arm64 kernel with CONFIG_PRINTK_INDEX=y and CONFIG_CEPH_FS=y by ca. 4 KiB. Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Xiubo Li <[email protected]> Reviewed-by: Chris Down <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/a21767eccb823435a7f18cdf115d7d572b4e945d.1709127473.git.geert+renesas@glider.be Signed-off-by: Petr Mladek <[email protected]>
1 parent 0381e58 commit b37cafa

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

include/linux/ceph/ceph_debug.h

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,13 @@
2727
##__VA_ARGS__)
2828
# else
2929
/* faux printk call just to see any compiler warnings. */
30-
# define dout(fmt, ...) do { \
31-
if (0) \
32-
printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
33-
} while (0)
34-
# define doutc(client, fmt, ...) do { \
35-
if (0) \
36-
printk(KERN_DEBUG "[%pU %llu] " fmt, \
37-
&client->fsid, \
38-
client->monc.auth->global_id, \
39-
##__VA_ARGS__); \
40-
} while (0)
30+
# define dout(fmt, ...) \
31+
no_printk(KERN_DEBUG fmt, ##__VA_ARGS__)
32+
# define doutc(client, fmt, ...) \
33+
no_printk(KERN_DEBUG "[%pU %llu] " fmt, \
34+
&client->fsid, \
35+
client->monc.auth->global_id, \
36+
##__VA_ARGS__)
4137
# endif
4238

4339
#else

0 commit comments

Comments
 (0)