class Allocator

Defined at line 129 of file ../../src/storage/minfs/allocator/allocator.h

Forward declaration for a reference to the internal allocator.

Public Methods

void ~Allocator ()

Defined at line 18 of file ../../src/storage/minfs/allocator/allocator_host.cc

zx::result<std::unique_ptr<Allocator>> Create (fs::BufferedOperationsBuilder * builder, std::unique_ptr<AllocatorStorage> storage)

static

Defined at line 47 of file ../../src/storage/minfs/allocator/allocator_common.cc

size_t GetAvailable ()

Return the number of total available elements, after taking reservations into account.

Defined at line 72 of file ../../src/storage/minfs/allocator/allocator_common.cc

size_t GetReserved ()

Returns the number of reserved blocks.

Defined at line 77 of file ../../src/storage/minfs/allocator/allocator_common.cc

void Allocator (const Allocator & )

Defined at line 133 of file ../../src/storage/minfs/allocator/allocator.h

Allocator & operator= (const Allocator & )

Defined at line 134 of file ../../src/storage/minfs/allocator/allocator.h

void Free (AllocatorReservation * reservation, size_t index)

Free an item from the allocator.

Defined at line 166 of file ../../src/storage/minfs/allocator/allocator_common.cc

fbl::Vector<BlockRegion> GetAllocatedRegions ()

Extract a vector of all currently allocated regions in the filesystem.

Defined at line 70 of file ../../src/storage/minfs/allocator/allocator.cc

bool CheckAllocated (size_t index)

Returns |true| if |index| is allocated. Returns |false| otherwise.

Defined at line 213 of file ../../src/storage/minfs/allocator/allocator_common.cc

size_t Allocate (AllocatorReservationKey , AllocatorReservation * reservation)

Allocate a single element and return its newly allocated index.

Defined at line 218 of file ../../src/storage/minfs/allocator/allocator_common.cc

zx::result<> Reserve (AllocatorReservationKey , PendingWork * transaction, size_t count)

Reserve |count| elements. This is required in order to later allocate them.

Outputs a |reservation| which contains reservation details.

Defined at line 193 of file ../../src/storage/minfs/allocator/allocator_common.cc

void Unreserve (AllocatorReservationKey , size_t count)

Unreserve |count| elements. This may be called in the event of failure, or if we

over-reserved initially.

PRECONDITION: AllocatorReservation must have |reserved| > 0.

Defined at line 232 of file ../../src/storage/minfs/allocator/allocator_common.cc

void Commit (PendingWork * transaction, AllocatorReservation * reservation)

Allocate / de-allocate elements from the given reservation. This persists the results of any

pending allocations/deallocations.

Since elements are only ever swapped synchronously, all elements represented in the

allocations_ and deallocations_ bitmaps are guaranteed to belong to only one Vnode. This method

should only be called in the same thread as the block swaps -- i.e. we should never be

resolving blocks for more than one vnode at a time.

Defined at line 122 of file ../../src/storage/minfs/allocator/allocator_common.cc

Friends

class PendingChange