Re: [PATCH v5 1/2] sunrpc: simplify dfprintk macros and fix nfsd build error

From: Geert Uytterhoeven

Date: Mon Mar 02 2026 - 08:20:51 EST


CC Andy

On Mon, 2 Mar 2026 at 14:13, Sean Chang <seanwascoding@xxxxxxxxx> wrote:
> On Mon, Mar 2, 2026 at 5:41 PM Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
> > This should have been fixed alteady, cfr.
> > "Re: [PATCH v3 0/3] sunrpc: Fix `make W=1` build issues"?
> > https://lore.kernel.org/177024270291.126397.9981743455921781902.b4-ty@xxxxxxxxxx
> >
>
> Hi Geert,
> Thanks for the feedback. Regarding the patch you mentioned, I've
> actually addressed this in the v6 series sent yesterday [1].
>
> My v6 approach is cleaner for a few reasons:
> 1. Compiler Optimization: In v6, we don't need explicit
> IS_ENABLED(CONFIG_SUNRPC_DEBUG) checks in files like
> fs/nfsd/nfsfh.c. With -O2, the compiler already proves these branches
> are unreachable and optimizes them away automatically.
>
> 2. Eliminating Redundancy: In include/linux/sunrpc/debug.h, the patch
> you cited adds no_printk inside an else branch of ifdebug, which is
> redundant. Since no_printk already performs type checking via
> ##__VA_ARGS__, simply refactoring the macro is sufficient:
> -# define dfprintk(fac, fmt, ...) do {} while (0)
> +# define dfprintk(fac, ...) no_printk(__VA_ARGS__)
>
> 3. Reducing Stubs: This also avoids the need for extra stub functions
> when CONFIG_SUNRPC_DEBUG is disabled, as seen in fs/lockd/svclock.c.
>
> This v6 series has already been reviewed by Andrew Lunn. I would
> appreciate it if you could take a look at the updated logic there.
>
> [1] https://lore.kernel.org/all/20260301161709.1365975-1-seanwascoding@xxxxxxxxx/T/#u
>
> Best Regards,
> Sean