[Bugfix][fast] Fix the get_num_blocks_touched logic (#6849)

This commit is contained in:
Zach Zheng
2024-08-08 10:43:30 -07:00
committed by GitHub
parent 21b9c49aa3
commit 782e53ab59
6 changed files with 172 additions and 10 deletions
+2 -3
View File
@@ -307,9 +307,8 @@ class NaiveBlockAllocator(BlockAllocator):
# TODO(cade): make sure the logic is correct and clean it up.
for block in blocks:
if not block.is_full and num_lookahead_slots != 0:
if block.num_empty_slots >= num_lookahead_slots:
new_block_count += 1
else:
new_block_count += 1
if num_lookahead_slots > block.num_empty_slots:
new_block_count += cdiv(
num_lookahead_slots - block.num_empty_slots,
self._block_size)