Fix object crc32c calculation

This commit is contained in:
Vitaliy Filippov
2025-12-02 01:52:12 +03:00
parent 2b8a9e3f90
commit 94f3634602
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -136,7 +136,7 @@ uint32_t heap_object_t::calc_crc32c()
{
uint32_t old_crc32c = crc32c;
crc32c = 0;
uint32_t res = ::crc32c(0, (uint8_t*)this, sizeof(this));
uint32_t res = ::crc32c(0, (uint8_t*)this, sizeof(heap_object_t));
for (heap_write_t *wr = get_writes(); wr; wr = wr->next())
{
res = ::crc32c(res, (uint8_t*)wr, wr->size);
+3 -3
View File
@@ -399,9 +399,9 @@ static void test_padded_csum_intent(bool perfect)
heap_object_t *obj = test.bs->heap->read_entry((object_id){ .inode = 1, .stripe = 0 }, NULL);
assert(obj);
assert(!obj->get_writes()->next()->next()->next());
assert(obj->get_writes()->flags == BS_HEAP_SMALL_WRITE);
assert(obj->get_writes()->next()->flags == (perfect ? BS_HEAP_SMALL_WRITE : BS_HEAP_INTENT_WRITE));
assert(obj->get_writes()->next()->next()->flags == BS_HEAP_BIG_WRITE);
assert(obj->get_writes()->entry_type == BS_HEAP_SMALL_WRITE);
assert(obj->get_writes()->next()->entry_type == (perfect ? BS_HEAP_SMALL_WRITE : BS_HEAP_INTENT_WRITE));
assert(obj->get_writes()->next()->next()->entry_type == BS_HEAP_BIG_WRITE);
// Commit
printf("commit version 3\n");
+1 -1
View File
@@ -640,7 +640,7 @@ void test_corruption()
// reload heap with corruption
{
blockstore_heap_t heap(&dsk, buffer_area.data());
heap.set_abort_on_corruption(true);
heap.set_abort_on_corruption(false);
tmp.data()[10]++; // corrupt the first object
heap.load_blocks(0, dsk.meta_block_size, tmp.data());
heap.finish_load();