class Allocator

Defined at line 50 of file ../../src/storage/blobfs/allocator/allocator.h

Allocates and frees both block and node entries.

Also maintains reservation mappings, to help in-progress allocations avoid from being persisted

too early.

Public Methods

void Allocator (SpaceManager * space_manager, RawBitmap block_map, fzl::ResizeableVmoMapper node_map, std::unique_ptr<id_allocator::IdAllocator> node_bitmap)

Defined at line 40 of file ../../src/storage/blobfs/allocator/allocator.cc

zx::result<InodePtr> GetNode (uint32_t node_index)

blobfs::NodeFinder interface.

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

void ~Allocator ()

Defined at line 54 of file ../../src/storage/blobfs/allocator/allocator.h

zx_status_t ResetFromStorage (fs::DeviceTransactionHandler & transaction_handler)

Reads the block map and node map from underlying storage, using a blocking read transaction.

It is unsafe to call this method while any nodes or blocks are reserved.

Defined at line 58 of file ../../src/storage/blobfs/allocator/allocator.cc

void SetLogging (bool enable)

Defined at line 59 of file ../../src/storage/blobfs/allocator/allocator.h

const zx::vmo & GetBlockMapVmo ()

Provides a read-only view into the block map.

Defined at line 109 of file ../../src/storage/blobfs/allocator/allocator.cc

const zx::vmo & GetNodeMapVmo ()

Provides a read-only view into the node map.

Defined at line 113 of file ../../src/storage/blobfs/allocator/allocator.cc

zx::result<ReservedNode> ReserveNode ()

blobfs::NodeReserverInterface interface.

Defined at line 115 of file ../../src/storage/blobfs/allocator/allocator.cc

void DropInodePtr ()

Called when InodePtr goes out of scope.

Defined at line 200 of file ../../src/storage/blobfs/allocator/allocator.cc

zx_status_t GrowNodeMap (size_t size)

Grows node map to |size|. The caller takes responsibility for initializing the new entries.

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

void Decommit ()

Decommits unused memory.

Defined at line 235 of file ../../src/storage/blobfs/allocator/allocator.cc

Protected Methods

zx::result<> AddBlocks (uint64_t block_count)

blobfs::BaseAllocator interface.

Defined at line 204 of file ../../src/storage/blobfs/allocator/allocator.cc

zx::result<> AddNodes ()

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