mirror_zfs/cmd/zdb
Andriy Tkachuk 6d378564b4 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
2025-08-05 12:33:00 -04:00
..
Makefile.am build: rename FORCEDEBUG_CPPFLAGS to LIBZPOOL_CPPFLAGS 2024-08-27 12:53:27 -07:00
zdb_il.c SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
zdb.c zdb: fix checksum calculation for decompressed blocks 2025-08-05 12:33:00 -04:00
zdb.h SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00