sunrpc: Fix `make W=1` build issues
Subsystems (4)
v2 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 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 +++++---- net/sunrpc/xprtrdma/svc_rdma_transport.c | 27 ++++++++++++------------ 5 files changed, 32 insertions(+), 23 deletions(-)
Signature · 1 line
2.50.1
PATCH v2 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
Re: [PATCH v2 1/3] nfs/blocklayout: Fix compilation error (`make W=1`) in bl_write_pagelist()
Quoted 11 lines · Andy Shevchenko
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.
Fixes 3a6fd1f004fc ("pnfs/blocklayout: remove read-modify-writehandling in
bl_write_pagelist")Signed-off-by Andy Shevchenko <[email protected]>
Quoted 36 lines
--- fs/nfs/blocklayout/blocklayout.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)fs/nfs/blocklayout/blocklayout.c +1
-2@@ -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. fs/nfs/blocklayout/blocklayout.c +0
-1* 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
Re: [PATCH v2 1/3] nfs/blocklayout: Fix compilation error (`make W=1`) in bl_write_pagelist()
Quoted 7 lines · Anna Schumaker
Quoted 6 lines · Andy Shevchenko
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]
Quoted 7 lines
Quoted 5 lines
Remove a leftover from the previous cleanup.
Fixes 3a6fd1f004fc ("pnfs/blocklayout: remove read-modify-writehandling in
bl_write_pagelist")Signed-off-by Andy Shevchenko <[email protected]>Acked-by Anna Schumaker <[email protected]>
Thank you!
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v2 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 v2 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 ++++++-- 2 files changed, 11 insertions(+), 2 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 /*
Signature · 1 line
2.50.1
Re: [PATCH v2 3/3] sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op
Quoted 9 lines · Andy Shevchenko
Clang 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()tono_printk(). The positive side-effect is a format-string checker enabled even for the cases whendprintk()is no-op.
I'm afraid this is not end of story...
I received a dozen of minutes ago a new report and now I'm investigating.
Patches 1 & 2 though are ready to go.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 3/3] sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op
Quoted 7 lines · Andy Shevchenko
Quoted 6 lines · Andy Shevchenko
Clang 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]
Quoted 8 lines
Quoted 3 lines
Fix these by forwarding parameters of
dprintk()tono_printk(). The positive side-effect is a format-string checker enabled even for the cases whendprintk()is no-op.I'm afraid this is not end of story...
I received a dozen of minutes ago a new report and now I'm investigating.Patches 1 & 2 though are ready to go.
Okay, if I'm not mistaken the only leftover is the missing tk_pid field due to conditional inclusion. However, if we do that unconditionally the data structure won't be expanded (there is a gap of 3 bytes. (Dunno about m68k, there may be actually +2 bytes due to 2-byte alignment.) The rest of the conditionally included members seem not being used in dprintk().
That said, removing ifdeffery around tk_pid in struct rpc_task should fix that problem.
If you can fold this to the patch 3, would be nice:
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;
Otherwise I can send a new version.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 3/3] sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op
Quoted 44 lines · Andy Shevchenko
Quoted 7 lines · Andy Shevchenko
Quoted 6 lines · Andy Shevchenko
Clang 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]Quoted 8 lines
Quoted 3 lines
Fix these by forwarding parameters of
dprintk()tono_printk(). The positive side-effect is a format-string checker enabled even for the cases whendprintk()is no-op.I'm afraid this is not end of story...
I received a dozen of minutes ago a new report and now I'm investigating.Patches 1 & 2 though are ready to go.
Okay, if I'm not mistaken the only leftover is the missing
tk_pidfield due to conditional inclusion. However, if we do that unconditionally the data structure won't be expanded (there is a gap of 3 bytes. (Dunno about m68k, there may be actually +2 bytes due to 2-byte alignment.) The rest of the conditionally included members seem not being used indprintk().That said, removing ifdeffery around
tk_pidin structrpc_taskshould fix that problem.If you can fold this to the patch 3, would be nice:
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;
Quoted 1 line
Otherwise I can send a new version.
Please send a full series respin, thanks.
Signature · 1 line
Chuck Lever
Re: [PATCH v2 3/3] sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op
Quoted 2 lines · Chuck Lever
Quoted 1 line · Andy Shevchenko
On Wed, Feb 04, 2026 at 06:46:36PM +0200, Andy Shevchenko wrote:
...
Quoted 3 lines
Quoted 1 line
Otherwise I can send a new version.
Please send a full series respin, thanks.
v3 has been sent.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 3 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.
Note, I assumed that this goes via NFS tree, but if net wants to take it, I will be glad as well!
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 18 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 v2:
- added patch to killRPC_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: KillRPC_IFDEBUG()
sunrpc: Fix compilation error (make W=1) whendprintk()is no-op
Quoted 6 lines
fs/lockd/svclock.c | 5 +++++ fs/nfs/blocklayout/blocklayout.c | 4 +--- fs/nfsd/nfsfh.c | 9 +++++--- include/linux/sunrpc/debug.h | 10 +++++---- net/sunrpc/xprtrdma/svc_rdma_transport.c | 27 ++++++++++++------------ 5 files changed, 32 insertions(+), 23 deletions(-)
These all look like good changes to me. The first patch should go to Trond/Anna and Chuck will probably pick up the other two?
Quoted 26 lines · Jeff Layton
Quoted 18 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 v2:
- added patch to killRPC_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: KillRPC_IFDEBUG()
sunrpc: Fix compilation error (make W=1) whendprintk()is no-opQuoted 6 lines
fs/lockd/svclock.c | 5 +++++ fs/nfs/blocklayout/blocklayout.c | 4 +--- fs/nfsd/nfsfh.c | 9 +++++--- include/linux/sunrpc/debug.h | 10 +++++---- net/sunrpc/xprtrdma/svc_rdma_transport.c | 27 ++++++++++++------------ 5 files changed, 32 insertions(+), 23 deletions(-)
Quoted 2 lines
These all look like good changes to me. The first patch should go to Trond/Anna and Chuck will probably pick up the other two?
That's what I was thinking, as long as there aren't any dependencies between 1/3 and the others.
Quoted 1 line
Reviewed-by Jeff Layton <[email protected]>
Signature · 1 line
Chuck Lever
Quoted 2 lines · Chuck Lever
Quoted 1 line · Jeff Layton
On Wed, 2026-02-04 at 10:41 +0100, Andy Shevchenko wrote:
...
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
Andy Shevchenko (3):
nfs/blocklayout: Fix compilation error (make W=1) in
bl_write_pagelist()
sunrpc: KillRPC_IFDEBUG()
sunrpc: Fix compilation error (make W=1) whendprintk()is no-opThese all look like good changes to me. The first patch should go to Trond/Anna and Chuck will probably pick up the other two?
That's what I was thinking, as long as there aren't any dependencies between 1/3 and the others.
There are no explicit compilation dependencies, but if one will wonder in the future the third patch alone may "fix" the first issue. That's why I prefer them going together.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 26 lines · Jeff Layton
Quoted 18 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 v2:
- added patch to killRPC_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: KillRPC_IFDEBUG()
sunrpc: Fix compilation error (make W=1) whendprintk()is no-opQuoted 6 lines
fs/lockd/svclock.c | 5 +++++ fs/nfs/blocklayout/blocklayout.c | 4 +--- fs/nfsd/nfsfh.c | 9 +++++--- include/linux/sunrpc/debug.h | 10 +++++---- net/sunrpc/xprtrdma/svc_rdma_transport.c | 27 ++++++++++++------------ 5 files changed, 32 insertions(+), 23 deletions(-)
Quoted 2 lines
These all look like good changes to me. The first patch should go to Trond/Anna and Chuck will probably pick up the other two?
As I explained in v1, the error in the first patch may be shadowed if the third one (and hence second) is taken first. That's why I prefer them to go via single place.
Quoted 1 line
Reviewed-by Jeff Layton <[email protected]>
Thanks!
Signature · 2 lines
With Best Regards, Andy Shevchenko
Chuck Lever
maintainerFrom: Chuck Lever <[email protected]>
Quoted 10 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 v2:
- added patch to killRPC_IFDEBUG()macro (LKP, Geert)
- united separate patches in the series
- collected tags (Geert)[...]
Applied to nfsd-testing, thanks!
Acks from the NFS client maintainers on 1/3 are welcome.
[1/3] nfs/blocklayout: Fix compilation error (make W=1) in bl_write_pagelist()
commit: b2e8b11ff47d3ba5075844ac4fb806296b3c4859
[2/3] sunrpc: Kill RPC_IFDEBUG()
commit: 85acbbcb4127f635c062cb52e5dbc62b0635b3f8
[3/3] sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op
commit: 380f84a3c8fc3809b614a6765c2fb0acc3e8674b--
Chuck Lever
Quoted 1 line · Chuck Lever
On Wed, 04 Feb 2026 10:41:20 +0100, Andy Shevchenko wrote:
[...]
Quoted 3 lines
Applied to nfsd-testing, thanks!
Acks from the NFS client maintainers on 1/3 are welcome.
Thank you!
Signature · 2 lines
With Best Regards, Andy Shevchenko