]> git.proxmox.com Git - mirror_zfs.git/commit
Cleanup ->dd_space_towrite should be unsigned
authorRichard Yao <richard.yao@alumni.stonybrook.edu>
Fri, 20 Jan 2023 19:10:15 +0000 (14:10 -0500)
committerGitHub <noreply@github.com>
Fri, 20 Jan 2023 19:10:15 +0000 (11:10 -0800)
commit856cefcd1c57da665e1690786a8be011ce7e4fa2
tree190473827376b3d198f0559d06b771bf27000cbb
parentebabb93e6c6e1849173206874a1543d8161225ab
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 <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14408
include/sys/dsl_dir.h
module/zfs/dsl_dir.c