Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <geert+renesas@glider.be>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Chris Down <chris@chrisdown.name>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/a21767eccb823435a7f18cdf115d7d572b4e945d.1709127473.git.geert+renesas@glider.be
Signed-off-by: Petr Mladek <pmladek@suse.com>

authored by

Geert Uytterhoeven and committed by
Petr Mladek
b37cafac 0381e588

+7 -11
+7 -11
include/linux/ceph/ceph_debug.h
··· 27 27 ##__VA_ARGS__) 28 28 # else 29 29 /* 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__) 41 37 # endif 42 38 43 39 #else