Verify checksums during journal reads

This commit is contained in:
Vitaliy Filippov
2023-07-29 12:17:18 +03:00
parent a166147110
commit 213a9ccb4d
10 changed files with 295 additions and 195 deletions
+3
View File
@@ -194,9 +194,12 @@ bool blockstore_impl_t::enqueue_write(blockstore_op_t *op)
data_csums[0] = fn(0, op->buf, op->len, op->offset - start*dsk.csum_block_size, end*dsk.csum_block_size - (op->offset+op->len));
else
{
// First block
data_csums[0] = fn(0, op->buf, dsk.csum_block_size*(start+1)-op->offset, op->offset - start*dsk.csum_block_size, 0);
// Intermediate blocks
for (uint32_t i = start+1; i < end; i++)
data_csums[i-start] = crc32c(0, (uint8_t*)op->buf + dsk.csum_block_size*i-op->offset, dsk.csum_block_size);
// Last block
data_csums[end-start] = fn(
0, (uint8_t*)op->buf + end*dsk.csum_block_size - op->offset,
op->offset+op->len - end*dsk.csum_block_size,