mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-09-15 13:50:11 +03:00
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
This commit is contained in:
parent
0c928f7a37
commit
6d378564b4
@ -9118,7 +9118,7 @@ zdb_read_block(char *thing, spa_t *spa)
|
|||||||
ck_zio->io_offset =
|
ck_zio->io_offset =
|
||||||
DVA_GET_OFFSET(&bp->blk_dva[0]);
|
DVA_GET_OFFSET(&bp->blk_dva[0]);
|
||||||
ck_zio->io_bp = bp;
|
ck_zio->io_bp = bp;
|
||||||
zio_checksum_compute(ck_zio, ck, pabd, lsize);
|
zio_checksum_compute(ck_zio, ck, pabd, psize);
|
||||||
printf(
|
printf(
|
||||||
"%12s\t"
|
"%12s\t"
|
||||||
"cksum=%016llx:%016llx:%016llx:%016llx\n",
|
"cksum=%016llx:%016llx:%016llx:%016llx\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user