Skip to contentSkip to conversation

nfs: flexfilelayout: fix unused-but-set variable 'err'

PATCH In review Kenner de Azevedo dos Santos Miranda 2 participants 3 messages Apr 28 – Apr 29

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfs: flexfilelayout: fix unused-but-set variable 'err'

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.

---
 fs/nfs/flexfilelayout/flexfilelayout.c | 1 +
 1 file changed, 1 insertion(+)
fs/nfs/flexfilelayout/flexfilelayout.c +1 -0
index 8b1559171fe3..d9a0fed41eac 100644
@@ -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:
Signature · 1 line
2.43.0
maintainer
#1 lore raw

Hi Kenner,

Quoted 8 lines · 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.

Wouldn't it be better to handle the error instead of ignoring it?

Thanks,
Anna

Quoted 25 lines

I didn`t test with hardware, i ran again the make w=1 and the warning was removed.

---
 fs/nfs/flexfilelayout/flexfilelayout.c | 1 +
 1 file changed, 1 insertion(+)
fs/nfs/flexfilelayout/flexfilelayout.c +1 -0
index 8b1559171fe3..d9a0fed41eac 100644
@@ -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:

Signature · 1 line
2.43.0
#2 lore raw

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

Quoted 43 lines · Anna Schumaker

Hi Kenner,

Quoted 8 lines · 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.

Wouldn't it be better to handle the error instead of ignoring it?

Thanks,
Anna

Quoted 25 lines

I didn`t test with hardware, i ran again the make w=1 and the warning was removed.

---
 fs/nfs/flexfilelayout/flexfilelayout.c | 1 +
 1 file changed, 1 insertion(+)
fs/nfs/flexfilelayout/flexfilelayout.c +1 -0
index 8b1559171fe3..d9a0fed41eac 100644
@@ -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