git: 1aa9b4e42326 - stable/13 - Fix unused variable warning in ffs_snapshot.c
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 29 Jul 2022 18:47:34 UTC
The branch stable/13 has been updated by dim:
URL: https://cgit.FreeBSD.org/src/commit/?id=1aa9b4e42326ee695ad80719b935463ffcd0a112
commit 1aa9b4e42326ee695ad80719b935463ffcd0a112
Author: Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-07-26 19:30:41 +0000
Commit: Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-07-29 18:29:59 +0000
Fix unused variable warning in ffs_snapshot.c
With clang 15, the following -Werror warning is produced:
sys/ufs/ffs/ffs_snapshot.c:204:7: error: variable 'redo' set but not used [-Werror,-Wunused-but-set-variable]
long redo = 0, snaplistsize = 0;
^
The 'redo' variable is only used when DIAGNOSTIC is defined. Ensure it
is only declared and set in that case.
MFC after: 3 days
(cherry picked from commit c9dde6f0c713a027266c52cf94a33a086348c566)
---
sys/ufs/ffs/ffs_snapshot.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index 5d5fb783e7d0..7cac1ec694a0 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -201,7 +201,10 @@ ffs_snapshot(struct mount *mp, char *snapfile)
ufs2_daddr_t blockno;
uint64_t flag;
char saved_nice = 0;
- long redo = 0, snaplistsize = 0;
+#ifdef DIAGNOSTIC
+ long redo = 0;
+#endif
+ long snaplistsize = 0;
int32_t *lp;
void *space;
struct fs *copy_fs = NULL, *fs;
@@ -457,7 +460,9 @@ restart:
for (cg = 0; cg < fs->fs_ncg; cg++) {
if ((ACTIVECGNUM(fs, cg) & ACTIVECGOFF(cg)) != 0)
continue;
+#ifdef DIAGNOSTIC
redo++;
+#endif
error = UFS_BALLOC(vp, lfragtosize(fs, cgtod(fs, cg)),
fs->fs_bsize, KERNCRED, 0, &nbp);
if (error)