Skip to contentSkip to conversation

xfs: remove unused variable in xrep_tempfile_copyin()

PATCH Applied Yiqing Wu 3 participants 3 messages Nov 16 – Nov 18 XFS filesystem

lore
Share & tools
lore

Yiqing Wu

author
#0 lore raw

PATCH 1/1 xfs: remove unused variable in xrep_tempfile_copyin()

The pos variable in xrep_tempfile_copyin() is initialized from the starting file offset and incremented on every iteration of the copy loop, but it is never used. GCC flags this as a dead assignment when building with W=1:

fs/xfs/scrub/tempfile.c:493:33: warning: variable pos set but not used [-Wunused-but-set-variable=]

Drop the variable and the loop increment.

---
 fs/xfs/scrub/tempfile.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/xfs/scrub/tempfile.c +1 -2
index 59a9213a3c7d..6340afcc22cf 100644
@@ -490,7 +490,6 @@ xrep_tempfile_copyin(
 	struct xfs_buf		*bp;
 	xfs_fileoff_t		flush_mask;
 	xfs_fileoff_t		end = off + len;
-	loff_t			pos = XFS_FSB_TO_B(mp, off);
 	int			error = 0;
 
 	ASSERT(S_ISREG(VFS_I(sc->tempip)->i_mode));
@@ -498,7 +497,7 @@ xrep_tempfile_copyin(
 	/* Flush buffers to disk every 512K */
 	flush_mask = XFS_B_TO_FSBT(mp, (1U << 19)) - 1;
 
-	for (; off < end; off++, pos += mp->m_sb.sb_blocksize) {
+	for (; off < end; off++) {
 		struct xfs_bmbt_irec	map;
 		int			nmaps = 1;
 
Signature · 1 line
2.56.0
maintainer Applied
#2 lore raw
In reply to Yiqing Wu
Quoted 8 lines · Yiqing Wu

The pos variable in xrep_tempfile_copyin() is initialized from the starting file offset and incremented on every iteration of the copy loop, but it is never used. GCC flags this as a dead assignment when building with W=1:

fs/xfs/scrub/tempfile.c:493:33: warning: variable pos set but not used [-Wunused-but-set-variable=]

[...]

Applied to for-next, thanks!

[1/1] xfs: remove unused variable in xrep_tempfile_copyin()

      commit: 5c7da17f904da61c6912ae719e8f3c3eb353ee88

Best regards,

Signature · 1 line
Carlos Maiolino <[email protected]>