git: 6ef6d3424f15 - stable/12 - Fix unused variable warning in ffs_snapshot.c
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 29 Jul 2022 18:48:38 UTC
The branch stable/12 has been updated by dim:
URL: https://cgit.FreeBSD.org/src/commit/?id=6ef6d3424f158a797d280ebd3103d4d833d41230
commit 6ef6d3424f158a797d280ebd3103d4d833d41230
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:43:14 +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 a65616fd04e0..1700a4094ae7 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -214,7 +214,10 @@ ffs_snapshot(mp, snapfile)
uint64_t flag;
struct timespec starttime = {0, 0}, endtime;
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)