* [PATCH] nfs: flexfilelayout: fix unused-but-set variable 'err'
@ 2026-04-28 19:59 Kenner de Azevedo dos Santos Miranda
2026-04-29 14:50 ` Anna Schumaker
0 siblings, 1 reply; 3+ messages in thread
From: Kenner de Azevedo dos Santos Miranda @ 2026-04-28 19:59 UTC (permalink / raw)
To: Trond Myklebust, Anna Schumaker
Cc: linux-nfs, linux-kernel, Jonathan Curley, Tigran Mkrtchyan,
Chuck Lever, Mike Snitzer, Kenner de Azevedo dos Santos Miranda
The variable int err in f_layout_io_track_ds_error() is set but not used in the code.
The warning was identified by running make w=1:
warning: variable ‘err’ set but not used
I set the (void)err to prevent the warning.
I didn`t test with hardware, i ran again the make w=1 and the warning was removed.
Signed-off-by: Kenner de Azevedo dos Santos Miranda <kenner.linuxdev@gmail.com>
---
fs/nfs/flexfilelayout/flexfilelayout.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 8b1559171fe3..d9a0fed41eac 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -1536,6 +1536,7 @@ static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg,
mirror, dss_id, offset, length, status, opnum,
nfs_io_gfp_mask());
+ (void)err;
switch (status) {
case NFS4ERR_DELAY:
case NFS4ERR_GRACE:
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nfs: flexfilelayout: fix unused-but-set variable 'err'
2026-04-28 19:59 [PATCH] nfs: flexfilelayout: fix unused-but-set variable 'err' Kenner de Azevedo dos Santos Miranda
@ 2026-04-29 14:50 ` Anna Schumaker
2026-04-29 16:17 ` kenner azevedi
0 siblings, 1 reply; 3+ messages in thread
From: Anna Schumaker @ 2026-04-29 14:50 UTC (permalink / raw)
To: Kenner de Azevedo dos Santos Miranda, Trond Myklebust
Cc: linux-nfs, linux-kernel, Jonathan Curley, Tigran Mkrtchyan,
Chuck Lever, Mike Snitzer
Hi Kenner,
On Tue, Apr 28, 2026, at 3:59 PM, Kenner de Azevedo dos Santos Miranda wrote:
> The variable int err in f_layout_io_track_ds_error() is set but not
> used in the code.
>
> The warning was identified by running make w=1:
>
> warning: variable ‘err’ set but not used
>
> I set the (void)err to prevent the warning.
Wouldn't it be better to handle the error instead of ignoring it?
Thanks,
Anna
>
> I didn`t test with hardware, i ran again the make w=1 and the warning
> was removed.
>
> Signed-off-by: Kenner de Azevedo dos Santos Miranda <kenner.linuxdev@gmail.com>
> ---
> fs/nfs/flexfilelayout/flexfilelayout.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c
> b/fs/nfs/flexfilelayout/flexfilelayout.c
> index 8b1559171fe3..d9a0fed41eac 100644
> --- a/fs/nfs/flexfilelayout/flexfilelayout.c
> +++ b/fs/nfs/flexfilelayout/flexfilelayout.c
> @@ -1536,6 +1536,7 @@ static void ff_layout_io_track_ds_error(struct
> pnfs_layout_segment *lseg,
> mirror, dss_id, offset, length, status, opnum,
> nfs_io_gfp_mask());
>
> + (void)err;
> switch (status) {
> case NFS4ERR_DELAY:
> case NFS4ERR_GRACE:
> --
> 2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nfs: flexfilelayout: fix unused-but-set variable 'err'
2026-04-29 14:50 ` Anna Schumaker
@ 2026-04-29 16:17 ` kenner azevedi
0 siblings, 0 replies; 3+ messages in thread
From: kenner azevedi @ 2026-04-29 16:17 UTC (permalink / raw)
To: Anna Schumaker
Cc: Trond Myklebust, linux-nfs, linux-kernel, Jonathan Curley,
Tigran Mkrtchyan, Chuck Lever, Mike Snitzer
Hi Anna, sure!
The error message is being used as information. If I replace dprintk
with pr_debug("%s: err %d op %d status %u\n", __func__, err, opnum,
status); I am telling the compiler that the variable is being used.
Fixing the warning.
Is this change reasonable?
Regards,
Kenner Azevedo
On Wed, Apr 29, 2026 at 10:50 AM Anna Schumaker <anna@kernel.org> wrote:
>
> Hi Kenner,
>
> On Tue, Apr 28, 2026, at 3:59 PM, Kenner de Azevedo dos Santos Miranda wrote:
> > The variable int err in f_layout_io_track_ds_error() is set but not
> > used in the code.
> >
> > The warning was identified by running make w=1:
> >
> > warning: variable ‘err’ set but not used
> >
> > I set the (void)err to prevent the warning.
>
> Wouldn't it be better to handle the error instead of ignoring it?
>
> Thanks,
> Anna
>
> >
> > I didn`t test with hardware, i ran again the make w=1 and the warning
> > was removed.
> >
> > Signed-off-by: Kenner de Azevedo dos Santos Miranda <kenner.linuxdev@gmail.com>
> > ---
> > fs/nfs/flexfilelayout/flexfilelayout.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c
> > b/fs/nfs/flexfilelayout/flexfilelayout.c
> > index 8b1559171fe3..d9a0fed41eac 100644
> > --- a/fs/nfs/flexfilelayout/flexfilelayout.c
> > +++ b/fs/nfs/flexfilelayout/flexfilelayout.c
> > @@ -1536,6 +1536,7 @@ static void ff_layout_io_track_ds_error(struct
> > pnfs_layout_segment *lseg,
> > mirror, dss_id, offset, length, status, opnum,
> > nfs_io_gfp_mask());
> >
> > + (void)err;
> > switch (status) {
> > case NFS4ERR_DELAY:
> > case NFS4ERR_GRACE:
> > --
> > 2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-29 16:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-28 19:59 [PATCH] nfs: flexfilelayout: fix unused-but-set variable 'err' Kenner de Azevedo dos Santos Miranda
2026-04-29 14:50 ` Anna Schumaker
2026-04-29 16:17 ` kenner azevedi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox