[PATCH] xfs: remove unused variable in xrep_tempfile_copyin()
From: Yiqing Wu
Date: Sun Nov 15 2026 - 21:05:35 EST
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.
Signed-off-by: Yiqing Wu <wuyiqing@xxxxxxxxxxxxxxxxxxxx>
---
fs/xfs/scrub/tempfile.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/xfs/scrub/tempfile.c b/fs/xfs/scrub/tempfile.c
index 59a9213a3c7d..6340afcc22cf 100644
--- a/fs/xfs/scrub/tempfile.c
+++ b/fs/xfs/scrub/tempfile.c
@@ -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;
--
2.56.0