ceph: Use no_printk() helper
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 28 Feb 2024 14:00:05 +0000 (15:00 +0100)
committerPetr Mladek <pmladek@suse.com>
Tue, 19 Mar 2024 15:11:42 +0000 (16:11 +0100)
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>
include/linux/ceph/ceph_debug.h

index 11a92a946016eab597d5fe3b9e023705b127b25a..5f904591fa5f9e57eff115dd88ee948c38fe2260 100644 (file)
                 ##__VA_ARGS__)
 # else
 /* faux printk call just to see any compiler warnings. */
-#  define dout(fmt, ...)       do {                            \
-               if (0)                                          \
-                       printk(KERN_DEBUG fmt, ##__VA_ARGS__);  \
-       } while (0)
-#  define doutc(client, fmt, ...)      do {                    \
-               if (0)                                          \
-                       printk(KERN_DEBUG "[%pU %llu] " fmt,    \
-                       &client->fsid,                          \
-                       client->monc.auth->global_id,           \
-                       ##__VA_ARGS__);                         \
-               } while (0)
+#  define dout(fmt, ...)                                       \
+               no_printk(KERN_DEBUG fmt, ##__VA_ARGS__)
+#  define doutc(client, fmt, ...)                              \
+               no_printk(KERN_DEBUG "[%pU %llu] " fmt,         \
+                         &client->fsid,                        \
+                         client->monc.auth->global_id,         \
+                         ##__VA_ARGS__)
 # endif
 
 #else