class Transaction

Defined at line 51 of file ../../src/storage/minfs/writeback.h

Tracks the current transaction, including any enqueued writes, and reserved blocks

and inodes. Also handles allocation of previously reserved blocks/inodes.

Upon construction, acquires a lock to ensure that all work being done within the

scope of the transaction is thread-safe. Specifically, the Minfs superblock, block bitmap, and

inode table, as well as the Vnode block count and inode size may in the near future be modified

asynchronously. Since these modifications require a Transaction to be in progress, this lock

will protect against multiple simultaneous writes to these structures.

Public Methods

zx::result<std::unique_ptr<Transaction>> Create (TransactionalFs * minfs, size_t reserve_inodes, size_t reserve_blocks, InodeManager * inode_manager)

Defined at line 36 of file ../../src/storage/minfs/writeback.cc

void Transaction ()

Defined at line 62 of file ../../src/storage/minfs/writeback.h

std::unique_ptr<Transaction> FromCachedBlockTransaction (TransactionalFs * minfs, std::unique_ptr<CachedBlockTransaction> cached_transaction)

Creates a Transaction object from CachedBlockTransaction. Consumes cached_transaction.

Defined at line 64 of file ../../src/storage/minfs/writeback.cc

AllocatorReservation & inode_reservation ()

Defined at line 69 of file ../../src/storage/minfs/writeback.h

AllocatorReservation & block_reservation ()

Defined at line 70 of file ../../src/storage/minfs/writeback.h

void Transaction (TransactionalFs * minfs, std::unique_ptr<CachedBlockTransaction> cached_transaction)

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

size_t AllocateBlock ()

Defined at line 78 of file ../../src/storage/minfs/writeback.h

void DeallocateBlock (size_t block)

Defined at line 80 of file ../../src/storage/minfs/writeback.h

void ~Transaction ()

Defined at line 82 of file ../../src/storage/minfs/writeback.cc

size_t AllocateInode ()

/////////////

Other methods.

Defined at line 84 of file ../../src/storage/minfs/writeback.h

std::vector<storage::UnbufferedOperation> RemoveMetadataOperations ()

Returns a vector of all enqueued metadata write operations.

Defined at line 94 of file ../../src/storage/minfs/writeback.h

std::vector<storage::UnbufferedOperation> RemoveDataOperations ()

Returns a vector of all enqueued data write operations.

Defined at line 99 of file ../../src/storage/minfs/writeback.h

size_t SwapBlock (size_t old_bno)

Defined at line 103 of file ../../src/storage/minfs/writeback.h

std::unique_ptr<AllocatorReservation> TakeBlockReservations (std::unique_ptr<Transaction> transaction)

Returns the block reservations within |transaction| and consumes |transaction|.

Asserts that there are no inode reservations.

Defined at line 109 of file ../../src/storage/minfs/writeback.h

std::vector<storage::BufferedOperation> TakeOperations ()

Defined at line 118 of file ../../src/storage/minfs/writeback.h

void EnqueueMetadata (storage::Operation operation, storage::BlockBuffer * buffer)

/////////////

PendingWork interface.

Defined at line 118 of file ../../src/storage/minfs/writeback.cc

void EnqueueData (storage::Operation operation, storage::BlockBuffer * buffer)

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

void PinVnode (fbl::RefPtr<VnodeMinfs> vnode)

No-op - don't need to pin vnodes on host.

NOLINTNEXTLINE(performance-unnecessary-value-param)

Defined at line 128 of file ../../src/storage/minfs/writeback.cc

zx::result<> ExtendBlockReservation (size_t reserve_blocks)

Extends block reservation by |reserve_blocks| number of blocks. It may fail

if the underlying allocator runs out of space.

Defined at line 131 of file ../../src/storage/minfs/writeback.cc

std::vector<fbl::RefPtr<VnodeMinfs>> RemovePinnedVnodes ()

Defined at line 114 of file ../../src/storage/minfs/writeback.cc