Re: [PATCH v2] sunrpc: simplify dprintk() macros and cleanup redundant debug guards
From: Andy Shevchenko <hidden>
Date: 2026-03-12 16:14:54
Also in:
linux-nfs, lkml
On Thu, Mar 12, 2026 at 11:54:15PM +0800, Sean Chang wrote:
On Thu, Mar 12, 2026 at 5:47 AM Andy Shevchenko [off-list ref] wrote:quoted
On Tue, Mar 03, 2026 at 10:07:25PM +0800, Sean Chang wrote:quoted
Following David Laight's suggestion, simplify the macro definitions by removing the unnecessary 'fmt' argument and using no_printk(__VA_ARGS__) directly. Verification with .lst files under -O2 confirms that the compiler successfully performs "dead code elimination". Even when variables (like char buf[] in nfsfh.c) or static helper functions (like nlmdbg_cookie2a() in svclock.c) are declared without #ifdef, they are completely optimized out (no stack allocation, no symbol references in the final executable) as they are only referenced within no_printk().Does this patch fixes also 202603110038.P6d14oxa-lkp@intel.com?Regarding the LKP report: I have reproduced the Sparse warning (void vs int mismatch) locally. To resolve this, I'll use the do-while(0) form in v3 to ensure the macro always evaluates to void: -# define dfprintk(fac, ...) no_printk(__VA_ARGS__) -# define dfprintk_rcu(fac, ...) no_printk(__VA_ARGS__) +# define dfprintk(fac, ...) do { no_printk(__VA_ARGS__); } while (0) +# define dfprintk_rcu(fac, ...) do { no_printk(__VA_ARGS__); } while (0)
Wouldn't be better to drop ({}) in nfs_error*() macros?
--
With Best Regards,
Andy Shevchenko