HomeFreeBSD

Cleanup ->dd_space_towrite should be unsigned

Description

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

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Jan 20 2023, 7:10 PM
GitHub <noreply@github.com>Committed on Jan 20 2023, 7:10 PM
Parents
rGebabb93e6c6e: Micro-optimize dsl_prop_get_dd()
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rG856cefcd1c57: Cleanup ->dd_space_towrite should be unsigned (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Jan 20 2023, 7:10 PM