Fix some blockstore bugs discovered by the mocked test!

This commit is contained in:
Vitaliy Filippov
2025-11-23 19:08:23 +03:00
parent 7b94969869
commit 7f7d79fdc9
6 changed files with 15 additions and 12 deletions
+2 -2
View File
@@ -566,11 +566,11 @@ bool blockstore_heap_t::calc_block_checksums(uint32_t *block_csums, uint8_t *dat
bool isset = false;
while (pos < end)
{
uint32_t prev = pos;
if (bitmap)
{
while (pos < end && pos < block_end)
{
uint32_t prev = pos;
while (pos < end && pos < block_end && !(bitmap[pos/dsk->bitmap_granularity/8] & (1 << ((pos/dsk->bitmap_granularity) % 8))))
pos += dsk->bitmap_granularity;
if (pos > prev && (isset || pos < block_end))
@@ -599,7 +599,7 @@ bool blockstore_heap_t::calc_block_checksums(uint32_t *block_csums, uint8_t *dat
{
if (bad_block_cb)
{
bad_block_cb(pos-start, *block_csums, block_crc);
bad_block_cb(prev-start, *block_csums, block_crc);
res = false;
}
else