class Minfs

Defined at line 170 of file ../../src/storage/minfs/minfs_private.h

Constructor is private and we mark the class final because the destructor will call Terminate

which will join threads and that won't be safe if it's been derived from.

Public Members

unique_ptr bc_

Public Methods

zx_status_t InitializeUnjournalledWriteback ()

Initializes the Minfs writeback queue and resolves any pending disk state (e.g., resolving

unlinked nodes and existing journal entries). Does not enable the journal.

zx::result<> ContinueTransaction (size_t reserve_blocks, std::unique_ptr<CachedBlockTransaction> cached_transaction, std::unique_ptr<Transaction> * out)

Converts a cached transaction into a Transaction. Extends block reservation

by |reserve_blocks|.

On failure to reserve blocks, returns error but |out| will have a transaction

that was converted.

Defined at line 44 of file ../../src/storage/minfs/minfs_target.cc

bool IsJournalErrored ()

Defined at line 15 of file ../../src/storage/minfs/minfs_target.cc

void EnqueueAllocation (std::unique_ptr<PendingWork> transaction)
bool AllReservationsBacked (const Transaction & )

Return true if the all outstanding block reservations are backed by persistent storage

(i.e. the volume has already been extended to cover all reservations).

Requires a Transaction to ensure the transaction lock is held.

Defined at line 94 of file ../../src/storage/minfs/minfs_target.cc

zx::result<> BlockingJournalSync ()

Issues a sync to the journal's background thread and waits for it to complete.

Defined at line 101 of file ../../src/storage/minfs/minfs_target.cc

void Minfs (const Minfs & )

Not copyable or movable

Defined at line 173 of file ../../src/storage/minfs/minfs_private.h

Minfs & operator= (const Minfs & )

Defined at line 174 of file ../../src/storage/minfs/minfs_private.h

void Minfs (Minfs && )

Defined at line 175 of file ../../src/storage/minfs/minfs_private.h

Minfs & operator= (Minfs && )

Defined at line 176 of file ../../src/storage/minfs/minfs_private.h

void InodeUpdate (PendingWork * transaction, ino_t ino, const Inode * inode)

Writes back an inode into the inode table on persistent storage.

Does not modify inode bitmap.

Defined at line 242 of file ../../src/storage/minfs/minfs_private.h

void InodeLoad (ino_t ino, Inode * out)

Reads an inode from the inode table into memory.

Defined at line 247 of file ../../src/storage/minfs/minfs_private.h

void ValidateBno (blk_t bno)

Defined at line 249 of file ../../src/storage/minfs/minfs_private.h

size_t WritebackCapacity ()

Returns the capacity of the writeback buffer, in blocks.

Defined at line 280 of file ../../src/storage/minfs/minfs_private.h

MinfsInspectTree * InspectTree ()

Mutable pointer to the MinfsInspectTree this object uses for metrics. Guaranteed non-nullptr.

Defined at line 310 of file ../../src/storage/minfs/minfs_private.h

fs_inspect::NodeOperations * GetNodeOperations ()

Defined at line 312 of file ../../src/storage/minfs/minfs_private.h

fs_inspect::NodeOperations * GetNodeOperations ()

Defined at line 314 of file ../../src/storage/minfs/minfs_private.h

const Superblock & Info ()

Returns an immutable reference to the superblock.

Defined at line 321 of file ../../src/storage/minfs/minfs_private.h

uint64_t BlockSize ()

Defined at line 323 of file ../../src/storage/minfs/minfs_private.h

const InspectableInodeManager * GetInodeManager ()

Gets an immutable reference to the InodeManager.

Defined at line 334 of file ../../src/storage/minfs/minfs_private.h

const Allocator & GetBlockAllocator ()

Gets an immutable reference to the block_allocator.

Defined at line 337 of file ../../src/storage/minfs/minfs_private.h

size_t BlocksAvailable ()

Returns number of blocks available.

Defined at line 339 of file ../../src/storage/minfs/minfs_private.h

size_t BlocksReserved ()

Returns number of reserved blocks but are yet to be allocated.

This helps to determine if we should fail incoming writes because we will

run out of space.

Defined at line 344 of file ../../src/storage/minfs/minfs_private.h

BlockOffsets GetBlockOffsets ()

Gets an immutable copy of offsets_.

Defined at line 348 of file ../../src/storage/minfs/minfs_private.h

const TransactionLimits & Limits ()

Defined at line 351 of file ../../src/storage/minfs/minfs_private.h

fbl::Mutex * GetLock ()

Defined at line 354 of file ../../src/storage/minfs/minfs_private.h

Bcache * GetMutableBcache ()

Defined at line 365 of file ../../src/storage/minfs/minfs_private.h

Allocator & GetBlockAllocator ()

Defined at line 370 of file ../../src/storage/minfs/minfs_private.h

Allocator & GetInodeAllocator ()

Defined at line 371 of file ../../src/storage/minfs/minfs_private.h

const MountOptions & mount_options ()

Defined at line 373 of file ../../src/storage/minfs/minfs_private.h

PlatformVfs * vfs ()

Defined at line 375 of file ../../src/storage/minfs/minfs_private.h

void ~Minfs ()

Defined at line 760 of file ../../src/storage/minfs/minfs.cc

std::unique_ptr<Bcache> Destroy (std::unique_ptr<Minfs> minfs)

Destroys a "minfs" object, but take back ownership of the bcache object.

Defined at line 528 of file ../../src/storage/minfs/minfs.cc

void Terminate ()

Terminates Minfs and joins all background threads. This will not necessarily guarantee all

all data has been flushed. Call Sync first if that matters.

Defined at line 533 of file ../../src/storage/minfs/minfs.cc

zx::result<std::unique_ptr<Minfs>> Create (FuchsiaDispatcher dispatcher, std::unique_ptr<Bcache> bc, const MountOptions & options, PlatformVfs * vfs)

Defined at line 1163 of file ../../src/storage/minfs/minfs.cc

zx::result<std::unique_ptr<Minfs>> Create (FuchsiaDispatcher dispatcher, std::unique_ptr<Bcache> bc, const MountOptions & options, PlatformVfs * vfs)

Defined at line 1163 of file ../../src/storage/minfs/minfs.cc

zx::result<> InitializeJournal (fs::JournalSuperblock journal_superblock)

Initializes the Minfs journal and writeback queue and resolves any pending disk state (e.g.,

resolving unlinked nodes and existing journal entries).

Defined at line 1304 of file ../../src/storage/minfs/minfs.cc

zx::result<fbl::RefPtr<VnodeMinfs>> VnodeGet (ino_t ino)

instantiate a vnode from an inode

the inode must exist in the file system

Defined at line 1016 of file ../../src/storage/minfs/minfs.cc

zx::result<fbl::RefPtr<VnodeMinfs>> VnodeNew (Transaction * transaction, uint32_t type)

instantiate a vnode with a new inode

Defined at line 969 of file ../../src/storage/minfs/minfs.cc

void VnodeInsert (VnodeMinfs * vn)

Insert, lookup, and remove vnode from hash map.

Defined at line 989 of file ../../src/storage/minfs/minfs.cc

fbl::RefPtr<VnodeMinfs> VnodeLookup (uint32_t ino)

Defined at line 999 of file ../../src/storage/minfs/minfs.cc

void VnodeRelease (VnodeMinfs * vn)

Defined at line 1009 of file ../../src/storage/minfs/minfs.cc

zx::result<fbl::RefPtr<VnodeMinfs>> OpenRootNode ()

Opens the root inode. This is a special-case of VnodeGet for filesystem bootstrapping.

Defined at line 1347 of file ../../src/storage/minfs/minfs.cc

void BlockNew (PendingWork * transaction, blk_t * out_bno)

Allocate a new data block from the block bitmap.

Defined at line 1042 of file ../../src/storage/minfs/minfs.cc

void UpdateFlags (PendingWork * transaction, uint32_t flags, bool set)

Set/Unset the flags.

Defined at line 1048 of file ../../src/storage/minfs/minfs.cc

void BlockSwap (Transaction * transaction, blk_t in_bno, blk_t * out_bno)

Mark |in_bno| for de-allocation (if it is > 0), and return a new block |*out_bno|.

The swap will not be persisted until the transaction is commited.

Defined at line 1058 of file ../../src/storage/minfs/minfs.cc

zx::result<> InoFree (Transaction * transaction, VnodeMinfs * vn)

Free ino in inode bitmap, release all blocks held by inode.

Defined at line 762 of file ../../src/storage/minfs/minfs.cc

void AddUnlinked (PendingWork * transaction, VnodeMinfs * vn)

Mark |vn| to be unlinked.

Defined at line 782 of file ../../src/storage/minfs/minfs.cc

void RemoveUnlinked (PendingWork * transaction, VnodeMinfs * vn)

Remove |vn| from the list of unlinked vnodes.

Defined at line 808 of file ../../src/storage/minfs/minfs.cc

zx::result<> PurgeUnlinked ()

Free resources of all vnodes marked unlinked.

Defined at line 840 of file ../../src/storage/minfs/minfs.cc

zx::result<std::unique_ptr<Transaction>> BeginTransaction (size_t reserve_inodes, size_t reserve_blocks)

Defined at line 552 of file ../../src/storage/minfs/minfs.cc

void EnqueueCallback (SyncCallback callback)

Defined at line 606 of file ../../src/storage/minfs/minfs.cc

void CommitTransaction (std::unique_ptr<Transaction> transaction)

Complete a transaction by enqueueing its WritebackWork to the WritebackQueue.

Defined at line 638 of file ../../src/storage/minfs/minfs.cc

void FsckAtEndOfTransaction ()

Runs fsck at the end of a transaction, just after metadata has been written. Used for testing

to be sure that all transactions leave the file system in a good state.

Defined at line 700 of file ../../src/storage/minfs/minfs.cc

zx::result<fs::FilesystemInfo> GetFilesystemInfo ()

Defined at line 1361 of file ../../src/storage/minfs/minfs.cc

void Sync (SyncCallback closure)

Signals the completion object as soon as the journal has finished synchronizing.

Defined at line 714 of file ../../src/storage/minfs/minfs.cc

zx::result<> ReadDat (blk_t bno, void * data)

The following methods are used to read one block from the specified extent,

from relative block |bno|.

|data| is an out parameter that must be a block in size, provided by the caller

These functions are single-block and synchronous. On Fuchsia, using the batched read

functions is preferred.

Defined at line 1614 of file ../../src/storage/minfs/minfs.cc

fbl::Vector<BlockRegion> GetAllocatedRegions ()

Record the location, size, and number of all non-free block regions.

Defined at line 1705 of file ../../src/storage/minfs/minfs.cc

void StopWriteback ()

Terminates all writeback queues, and flushes pending operations to the underlying device.

If |!IsReadonly()|, also sets the dirty bit to a "clean" status.

Defined at line 917 of file ../../src/storage/minfs/minfs.cc