From 9a9d2c01cadbfc0cd70b7b47fcf98d704af93e70 Mon Sep 17 00:00:00 2001 From: koolkdev Date: Thu, 15 Feb 2024 01:35:38 +0200 Subject: [PATCH] fix free blocks allocator --- src/free_blocks_allocator.cpp | 4 +++- src/free_blocks_allocator_tree.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/free_blocks_allocator.cpp b/src/free_blocks_allocator.cpp index c39683c..4cbfdc2 100644 --- a/src/free_blocks_allocator.cpp +++ b/src/free_blocks_allocator.cpp @@ -8,4 +8,6 @@ #include "free_blocks_allocator.h" FreeBlocksAllocator::FreeBlocksAllocator(std::shared_ptr area, std::shared_ptr root_block) - : area_(area), tree_{Adapter{area}, root_block->BlockNumber()}, root_block_(std::move(root_block)) {} + : area_(area), + tree_{Adapter{area}, area->RelativeBlockNumber(root_block->BlockNumber())}, + root_block_(std::move(root_block)) {} diff --git a/src/free_blocks_allocator_tree.h b/src/free_blocks_allocator_tree.h index 5cf33be..e3ece4a 100644 --- a/src/free_blocks_allocator_tree.h +++ b/src/free_blocks_allocator_tree.h @@ -494,7 +494,8 @@ class EPTreeIterator { template std::array, N> CreateFTreeArray(uint32_t block_number, std::index_sequence) { - return {{FTree(blocks_retriever_.get_block(block_number), Is)...}}; + auto block = blocks_retriever_.get_block(block_number); + return {{FTree(block, Is)...}}; } value_type operator*() {