aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2023-01-20 14:10:15 -0500
committerGitHub <[email protected]>2023-01-20 11:10:15 -0800
commit856cefcd1c57da665e1690786a8be011ce7e4fa2 (patch)
tree190473827376b3d198f0559d06b771bf27000cbb /module/zfs
parentebabb93e6c6e1849173206874a1543d8161225ab (diff)
Cleanup ->dd_space_towrite should be unsigned
This is only ever used with unsigned data, so the type itself should be unsigned. Also, PVS Studio's 2016 FreeBSD kernel report correctly identified the following assertion as always being true, so we can drop it: ASSERT3U(dd->dd_space_towrite[i & TXG_MASK], >=, 0); The reason it was always true is because it would do casts to give us unsigned comparisons. This could have been fixed by switching to `ASSERT3S()`, but upon inspection, it turned out that this variable never should have been allowed to be signed in the first place. Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #14408
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/dsl_dir.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c
index c1afaa6aa..18142cef9 100644
--- a/module/zfs/dsl_dir.c
+++ b/module/zfs/dsl_dir.c
@@ -1186,10 +1186,9 @@ dsl_dir_space_towrite(dsl_dir_t *dd)
ASSERT(MUTEX_HELD(&dd->dd_lock));
- for (int i = 0; i < TXG_SIZE; i++) {
+ for (int i = 0; i < TXG_SIZE; i++)
space += dd->dd_space_towrite[i & TXG_MASK];
- ASSERT3U(dd->dd_space_towrite[i & TXG_MASK], >=, 0);
- }
+
return (space);
}