Fix object crc32c calculation
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user