src/storage/blobfs/test/unit/utils.cc
// Force the allocator to become maximally fragmented by allocating
// every-other block within up to |blocks|.
Force the allocator to become maximally fragmented by allocating
every-other block within up to |blocks|.
Force the allocator to become maximally fragmented by allocating every - other block within up to |blocks| .
void ForceFragmentation(Allocator* allocator, size_t blocks) {
  fbl::Vector<ReservedExtent> extents[blocks];
  for (size_t i = 0; i < blocks; i++) {
    ASSERT_EQ(allocator->ReserveBlocks(1, &extents[i]), ZX_OK);
    ASSERT_EQ(1ul, extents[i].size());
  }
  for (size_t i = 0; i < blocks; i += 2) {
    allocator->MarkBlocksAllocated(extents[i][0]);
  }
}
void ForceFragmentation ( Allocator * allocator , size_t blocks ) { fbl :: Vector < ReservedExtent > extents [ blocks ] ; for ( size_t i = 0 ; i < blocks ; i ++ ) { ASSERT_EQ ( allocator -> ReserveBlocks ( 1 , & extents [ i ] ) , ZX_OK ) ; ASSERT_EQ ( 1ul , extents [ i ] . size ( ) ) ; } for ( size_t i = 0 ; i < blocks ; i += 2 ) { allocator -> MarkBlocksAllocated ( extents [ i ] [ 0 ] ) ; } }
Force the allocator to become maximally fragmented by allocating
every-other block within up to |blocks|.
Force the allocator to become maximally fragmented by allocating every - other block within up to |blocks| .