[PATCH v3 0/3] sunrpc/nfs: cleanup redundant debug checks and refactor macros

Sean Chang posted 3 patches 2 weeks, 3 days ago
There is a newer version of this series
fs/lockd/svclock.c                       |  7 ------
fs/nfs/internal.h                        | 28 +++++++++++-------------
fs/nfsd/nfsfh.c                          |  8 +++----
net/sunrpc/xprtrdma/svc_rdma_transport.c | 25 ++++++++++-----------
4 files changed, 27 insertions(+), 41 deletions(-)
[PATCH v3 0/3] sunrpc/nfs: cleanup redundant debug checks and refactor macros
Posted by Sean Chang 2 weeks, 3 days ago
This series cleans up redundant IS_ENABLED(CONFIG_SUNRPC_DEBUG) guards 
across sunrpc, nfsd, and lockd, as these checks are already handled 
within the dprintk macros.

Additionally, it refactors the nfs_errorf() macros into a safer 
do-while(0) pattern and removes unused nfs_warnf() macros to improve 
code maintainability.

v3:
- Added nfs_errorf refactoring and removed unused nfs_warnf macros.
- Split sunrpc and nfsd changes for better clarity.

v2:
 - Follow reversed xmas tree order for variables in svc_rdma_transport.c
   as requested by Andy Shevchenko.
 - Polish commit message: use dprintk() and remove redundant file list.
 - Correct the technical claim about dprintk() type checking.

Sean Chang (3):
  nfsd/lockd: Remove redundant debug checks
  svcrdma: remove redundant IS_ENABLED(CONFIG_SUNRPC_DEBUG) guards
  nfs: refactor nfs_errorf macros and remove unused ones

 fs/lockd/svclock.c                       |  7 ------
 fs/nfs/internal.h                        | 28 +++++++++++-------------
 fs/nfsd/nfsfh.c                          |  8 +++----
 net/sunrpc/xprtrdma/svc_rdma_transport.c | 25 ++++++++++-----------
 4 files changed, 27 insertions(+), 41 deletions(-)

-- 
2.34.1
Re: [PATCH v3 0/3] sunrpc/nfs: cleanup redundant debug checks and refactor macros
Posted by Andy Shevchenko 2 weeks, 2 days ago
On Thu, Mar 19, 2026 at 10:18:43PM +0800, Sean Chang wrote:
> This series cleans up redundant IS_ENABLED(CONFIG_SUNRPC_DEBUG) guards 
> across sunrpc, nfsd, and lockd, as these checks are already handled 
> within the dprintk macros.
> 
> Additionally, it refactors the nfs_errorf() macros into a safer 
> do-while(0) pattern and removes unused nfs_warnf() macros to improve 
> code maintainability.

Shall we also revert the commit ebae102897e7 ("nfsd: Mark variable
__maybe_unused to avoid W=1 build break") as it seems related to
dprintk() issues?


-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v3 0/3] sunrpc/nfs: cleanup redundant debug checks and refactor macros
Posted by Sean Chang 2 weeks, 2 days ago
On Fri, Mar 20, 2026 at 8:08 PM Andy Shevchenko
<andriy.shevchenko@intel.com> wrote:
>
> On Thu, Mar 19, 2026 at 10:18:43PM +0800, Sean Chang wrote:
> > This series cleans up redundant IS_ENABLED(CONFIG_SUNRPC_DEBUG) guards
> > across sunrpc, nfsd, and lockd, as these checks are already handled
> > within the dprintk macros.
> >
> > Additionally, it refactors the nfs_errorf() macros into a safer
> > do-while(0) pattern and removes unused nfs_warnf() macros to improve
> > code maintainability.
>
> Shall we also revert the commit ebae102897e7 ("nfsd: Mark variable
> __maybe_unused to avoid W=1 build break") as it seems related to
> dprintk() issues?
>

That's a great catch. I've verified that with the new dprintk() refactoring,
those __maybe_unused attributes are indeed redundant. I will include a
new patch in v4 to remove them and properly credit the cleanup. Thanks!

Best Regards,
Sean