Fix padded block checksums - v2

This commit is contained in:
Vitaliy Filippov
2026-07-05 14:09:57 +03:00
parent d48864a6be
commit 5dbc679e16
2 changed files with 54 additions and 20 deletions
+1 -2
View File
@@ -1139,7 +1139,6 @@ bool blockstore_heap_t::calc_block_checksums(uint32_t *block_csums, uint8_t *bit
{
bool res = true;
uint32_t pos = start;
uint32_t block_start = (start/dsk->csum_block_size)*dsk->csum_block_size;
uint32_t block_end = (start/dsk->csum_block_size + 1)*dsk->csum_block_size;
uint32_t block_crc = 0;
bool isset = false;
@@ -1154,7 +1153,7 @@ bool blockstore_heap_t::calc_block_checksums(uint32_t *block_csums, uint8_t *bit
while (pos < end && pos < block_end && !(bitmap[pos/dsk->bitmap_granularity/8] & (1 << ((pos/dsk->bitmap_granularity) % 8))))
pos += dsk->bitmap_granularity;
// zero padding at the beginning or at the end of the block is not counted
if (pos > prev && prev > block_start && pos < block_end)
if (pos > prev && prev > blk_start && pos < block_end)
block_crc = crc32c_pad(block_crc, NULL, 0, pos-prev, 0);
prev = pos;
while (pos < end && pos < block_end && (bitmap[pos/dsk->bitmap_granularity/8] & (1 << ((pos/dsk->bitmap_granularity) % 8))))