# Re: \[PATCH\] sunrpc: simplify dprintk macros and cleanup redundant debug guards

- From: Andy Shevchenko \<hidden\>
- Date: 2026-03-02 16:51:31 
- List: netdev
- Page: https://ratatoskr.run/netdev/2026/03/3436047
- Thread: https://ratatoskr.run/netdev/2026/03/3435940/t.md

```text
On Tue, Mar 03, 2026 at 12:18:18AM +0800, Sean Chang wrote:

In the Subject: dprintk --> dprintk()

> Following David Laight's suggestion, simplify the macro definitions by
> removing the unnecessary 'fmt' argument and using no_printk(__VA_ARGS__)
> directly.

> This ensures the compiler performs type checking

This is already the case with the current code.

> and "sees" the variables, silencing the warnings without emitting any code.

Also, isn't it the current state of affairs?

> 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().
> 
> This allows for significant cleanup:
> - Remove redundant #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) from
>   fs/nfsd/nfsfh.c and net/sunrpc/xprtrdma/svc_rdma_transport.c
> - Remove the #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) guard around
>   nlmdbg_cookie2a and stub function in fs/lockd/svclock.c

nlmdbg_cookie2a()

> - Consolidate the dprintk definition to be more idiomatic.

dprintk()


Isn't this list redundant in the commit message? We can see this from the code
without much brain used.

...

>  	struct ib_qp_init_attr qp_attr;
>  	struct ib_device *dev;
>  	int ret = 0;
> +	struct sockaddr *sap;

Keep it in reversed xmas tree order.

...

Ideally it would be nice to have this patch squashed to the mine, but I think
since it's part of nfsd-next, the rebasing is not an option. Since I am not
the maintainer, just my 2c.

-- 
With Best Regards,
Andy Shevchenko


```
