sunrpc: Fix `make W=1` build issues
Subsystems (4)
v3 cover sunrpc: Fix `make W=1` build issues
Compiler is not happy about unused variables (especially when dprintk() call is defined as no-op). Here is the series to address the issues.
Changelog v3:
- removed ifdeffery to have struct rpc_task::tk_pid available (LKP)
- collected more tags (Anna, Jeff)
Changelog v2:
- added patch to kill RPC_IFDEBUG() macro (LKP, Geert)
- united separate patches in the series
- collected tags (Geert)
v1: [email protected]
v1: [email protected]
Andy Shevchenko (3):
nfs/blocklayout: Fix compilation error (make W=1) in
bl_write_pagelist()
sunrpc: Kill RPC_IFDEBUG()
sunrpc: Fix compilation error (make W=1) when dprintk() is no-op
fs/lockd/svclock.c | 5 +++++ fs/nfs/blocklayout/blocklayout.c | 4 +--- fs/nfsd/nfsfh.c | 9 +++++--- include/linux/sunrpc/debug.h | 10 +++++---- include/linux/sunrpc/sched.h | 3 --- net/sunrpc/xprtrdma/svc_rdma_transport.c | 27 ++++++++++++------------ 6 files changed, 32 insertions(+), 26 deletions(-)
Signature · 1 line
2.50.1
PATCH v3 1/3 nfs/blocklayout: Fix compilation error (`make W=1`) in bl_write_pagelist()
Clang compiler is not happy about set but unused variable (when dprintk() is no-op):
.../blocklayout/blocklayout.c:384:9: error: variable 'count' set but not used [-Werror,-Wunused-but-set-variable]
Remove a leftover from the previous cleanup.
--- fs/nfs/blocklayout/blocklayout.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/nfs/blocklayout/blocklayout.c +1 -3
@@ -381,14 +381,13 @@ bl_write_pagelist(struct nfs_pgio_header *header, int sync)sector_t isect, extent_length =0 ;struct parallel_io *par =NULL ;loff_t offset = header->args.offset; -size_t count = header->args.count;struct page **pages = header->args.pages;int pg_index = header->args.pgbase >>PAGE_SHIFT ;unsigned int pg_len;struct blk_plug plug;int i; -dprintk ("%s enter, %zu@%lld\n" , __func__, count, offset); +dprintk ("%s enter, %u@%lld\n" , __func__, header->args.count, offset);/* At this point, header->page_aray is a (sequential) list of nfs_pages. * We want to write each, and if there is an error set pnfs_error
@@ -429,7 +428,6 @@ bl_write_pagelist(struct nfs_pgio_header *header, int sync) } offset += pg_len; - count -= pg_len; isect += (pg_len >>SECTOR_SHIFT ); extent_length -= (pg_len >>SECTOR_SHIFT ); }
Signature · 1 line
2.50.1
PATCH v3 2/3 sunrpc: Kill RPC_IFDEBUG()
In reply to Andy ShevchenkoRPC_IFDEBUG() is used in only two places. In one the user of the definition is guarded by ifdeffery, in the second one it's implied due to dprintk() usage. Kill the macro and move the ifdeffery to the regular condition with the variable defined inside, while in the second case add the same conditional and move the respective code there.
--- fs/nfsd/nfsfh.c | 9 +++++--- include/linux/sunrpc/debug.h | 2 -- net/sunrpc/xprtrdma/svc_rdma_transport.c | 27 ++++++++++++------------ 3 files changed, 20 insertions(+), 18 deletions(-)
fs/nfsd/nfsfh.c +6 -3
@@ -105,9 +105,12 @@ static __be32 nfsd_setuser_and_check_port(struct svc_rqst *rqstp, {/* Check if the request originated from a secure port. */ if (rqstp && !nfsd_originating_port_ok (rqstp, cred, exp)) { - RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]); -dprintk ("nfsd: request from insecure port %s!\n" , -svc_print_addr (rqstp, buf,sizeof (buf))); +if (IS_ENABLED (CONFIG_SUNRPC_DEBUG )) { +char buf[RPC_MAX_ADDRBUFLEN ]; + +dprintk ("nfsd: request from insecure port %s!\n" , +svc_print_addr (rqstp, buf,sizeof (buf))); + }return nfserr_perm; }
include/linux/sunrpc/debug.h +0 -2
@@ -51,12 +51,10 @@ do { \ } \ } while (0) -# define RPC_IFDEBUG (x) x#else # define ifdebug (fac) if (0)# define dfprintk (fac, fmt, ...) do {} while (0)# define dfprintk_rcu (fac, fmt, ...) do {} while (0) -# define RPC_IFDEBUG (x)#endif /*
net/sunrpc/xprtrdma/svc_rdma_transport.c +14 -13
@@ -414,7 +414,6 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)struct ib_qp_init_attr qp_attr;struct ib_device *dev;int ret =0 ; - RPC_IFDEBUG(struct sockaddr *sap); listen_rdma = container_of(xprt, struct svcxprt_rdma, sc_xprt);clear_bit (XPT_CONN , &xprt->xpt_flags);
@@ -560,18 +559,20 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) goto errout; } -#if IS_ENABLED (CONFIG_SUNRPC_DEBUG ) -dprintk ("svcrdma: new connection accepted on device %s:\n" , dev->name); - sap = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.src_addr; -dprintk (" local address : %pIS:%u\n" , sap,rpc_get_port (sap)); - sap = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.dst_addr; -dprintk (" remote address : %pIS:%u\n" , sap,rpc_get_port (sap)); -dprintk (" max_sge : %d\n" , newxprt->sc_max_send_sges); -dprintk (" sq_depth : %d\n" , newxprt->sc_sq_depth); -dprintk (" rdma_rw_ctxs : %d\n" , ctxts); -dprintk (" max_requests : %d\n" , newxprt->sc_max_requests); -dprintk (" ord : %d\n" , conn_param.initiator_depth); -#endif +if (IS_ENABLED (CONFIG_SUNRPC_DEBUG )) { +struct sockaddr *sap; + +dprintk ("svcrdma: new connection accepted on device %s:\n" , dev->name); + sap = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.src_addr; +dprintk (" local address : %pIS:%u\n" , sap,rpc_get_port (sap)); + sap = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.dst_addr; +dprintk (" remote address : %pIS:%u\n" , sap,rpc_get_port (sap)); +dprintk (" max_sge : %d\n" , newxprt->sc_max_send_sges); +dprintk (" sq_depth : %d\n" , newxprt->sc_sq_depth); +dprintk (" rdma_rw_ctxs : %d\n" , ctxts); +dprintk (" max_requests : %d\n" , newxprt->sc_max_requests); +dprintk (" ord : %d\n" , conn_param.initiator_depth); + }return &newxprt->sc_xprt;
Signature · 1 line
2.50.1
PATCH v3 3/3 sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op
In reply to Andy ShevchenkoClang compiler is not happy about set but unused variables:
.../flexfilelayout/flexfilelayoutdev.c:56:9: error: variable 'ret' set but not used [-Werror,-Wunused-but-set-variable] .../flexfilelayout/flexfilelayout.c:1505:6: error: variable 'err' set but not used [-Werror,-Wunused-but-set-variable] .../nfs4proc.c:9244:12: error: variable 'ptr' set but not used [-Werror,-Wunused-but-set-variable]
Fix these by forwarding parameters of dprintk() to no_printk(). The positive side-effect is a format-string checker enabled even for the cases when dprintk() is no-op.
--- fs/lockd/svclock.c | 5 +++++ include/linux/sunrpc/debug.h | 8 ++++++-- include/linux/sunrpc/sched.h | 3 --- 3 files changed, 11 insertions(+), 5 deletions(-)
fs/lockd/svclock.c +5 -0
@@ -80,6 +80,11 @@ static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie) return buf; } +#else +static inline const char *nlmdbg_cookie2a (const struct nlm_cookie *cookie) +{ +return "???" ; +}#endif /*
include/linux/sunrpc/debug.h +6 -2
@@ -40,6 +40,8 @@ extern unsigned int nlm_debug;do { \ ifdebug(fac) \ __sunrpc_printk(fmt, ##__VA_ARGS__); \ + else \ + no_printk(fmt, ##__VA_ARGS__); \ } while (0)# define dfprintk_rcu (fac, fmt, ...) \
@@ -48,13 +50,15 @@ do { \rcu_read_lock (); \ __sunrpc_printk(fmt, ##__VA_ARGS__); \ rcu_read_unlock(); \ + }else { \ + no_printk(fmt, ##__VA_ARGS__); \ } \ } while (0)#else # define ifdebug (fac) if (0) -# define dfprintk (fac, fmt, ...) do {} while (0) -# define dfprintk_rcu (fac, fmt, ...) do {} while (0) +# define dfprintk (fac, fmt, ...) no_printk(fmt, ##__VA_ARGS__) +# define dfprintk_rcu (fac, fmt, ...) no_printk(fmt, ##__VA_ARGS__)#endif /*
include/linux/sunrpc/sched.h +0 -3
@@ -95,10 +95,7 @@ struct rpc_task {int tk_rpc_status;/* Result of last RPC operation */ unsigned short tk_flags;/* misc flags */ unsigned short tk_timeouts;/* maj timeouts */ - -#if IS_ENABLED (CONFIG_SUNRPC_DEBUG ) ||IS_ENABLED (CONFIG_TRACEPOINTS )unsigned short tk_pid;/* debugging aid */ -#endif unsigned char tk_priority : 2,/* Task priority */ tk_garb_retry : 2, tk_cred_retry : 2;
Signature · 1 line
2.50.1
Chuck Lever
maintainerFrom: Chuck Lever <[email protected]>
Quoted 9 lines · Andy Shevchenko
Compiler is not happy about unused variables (especially when
dprintk()call is defined as no-op). Here is the series to address the issues.Changelog v3:
- removed ifdeffery to have structrpc_task::tk_pidavailable (LKP)
- collected more tags (Anna, Jeff)[...]
Applied to nfsd-testing, thanks!
[1/3] nfs/blocklayout: Fix compilation error (make W=1) in bl_write_pagelist()
commit: 5ea3d8c52742bc3fef3b1399ecb6d750fa94b11c
[2/3] sunrpc: Kill RPC_IFDEBUG()
commit: 69998e1a90d71181df815570a89e972a8bde2b0e
[3/3] sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op
commit: d5a6213462466a15cecb601896eb4df81aa13b9f--
Chuck Lever
Quoted 1 line · Chuck Lever
On Wed, 04 Feb 2026 21:21:48 +0100, Andy Shevchenko wrote:
[...]
Quoted 1 line
Applied to nfsd-testing, thanks!
Thanks!
FWIW, I have got a success report from LKP.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Chuck Lever
On Wed, 04 Feb 2026 21:21:48 +0100, Andy Shevchenko wrote:
[...]
Quoted 5 lines
Quoted 1 line
Applied to nfsd-testing, thanks!
Thanks!
FWIW, I have got a success report from LKP.
Any estimations when this appears in Linux Next (or even vanilla)?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 6 lines · Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Chuck Lever
On Wed, 04 Feb 2026 21:21:48 +0100, Andy Shevchenko wrote:
[...]
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Applied to nfsd-testing, thanks!
Thanks!
FWIW, I have got a success report from LKP.
Any estimations when this appears in Linux Next (or even vanilla)?
Applied to nfsd-next just now. Should appear in linux-next the next time nfsd-next is pulled (Sunday night US/Eastern, maybe?)
Signature · 1 line
Chuck Lever
Quoted 4 lines · Chuck Lever
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Chuck Lever
On Wed, 04 Feb 2026 21:21:48 +0100, Andy Shevchenko wrote:
[...]
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Applied to nfsd-testing, thanks!
Thanks!
FWIW, I have got a success report from LKP.
Any estimations when this appears in Linux Next (or even vanilla)?
Applied to nfsd-next just now. Should appear in linux-next the next time nfsd-next is pulled (Sunday night US/Eastern, maybe?)
Yep, I think it will be in today's Linux Next, thank you!
Signature · 2 lines
With Best Regards, Andy Shevchenko