HomeFreeBSD

zdb: fix checksum calculation for decompressed blocks

Description

zdb: fix checksum calculation for decompressed blocks

Currently, when reading compressed blocks with -R and decompressing
them with :d option and specifying lsize, which is normally bigger
than psize for compressed blocks, the checksum is calculated on
decompressed data. But it makes no sense since zfs always calculates
checksum on physical, i.e. compressed data. So reading the same block
produces different checksum results depending on how we read it,
whether we decompress it or not, which, again, makes no sense.

Fix: use psize instead of lsize when calculating the checksum so that
it is always calculated on the physical block size, no matter was it
compressed or not.

Signed-off-by: Andriy Tkachuk <andriy.tkachuk@seagate.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Closes #17547

Details

Provenance
Andriy Tkachuk <andriy.tkachuk@seagate.com>Authored on Jul 25 2025, 1:24 AM
GitHub <noreply@github.com>Committed on Jul 25 2025, 1:24 AM
Parents
rGa8646a81865b: ZED: Fix device type detection and pool iteration logic
Branches
Unknown
Tags
Unknown