Enumerations

enum UpdateMode
Name Value
kRelative 0
kNoAccess 1
kStrict 2
kNum 3

Defined at line 12 of file ../../src/storage/f2fs/timestamp.h

enum MountOption
Name Value
kBgGcOff 0
kDisableRollForward 1
kDiscard 2
kNoUserXAttr 3
kNoAcl 4
kDisableExtIdentify 5
kInlineXattr 6
kInlineDentry 7
kForceLfs 8
kReadOnly 9
kReadExtentCache 10
kActiveLogs 11
kMaxNum 12

Defined at line 13 of file ../../src/storage/f2fs/mount.h

enum VmoMode
Name Value
kDiscardable 0
kPaged 1

Defined at line 19 of file ../../src/storage/f2fs/vmo_manager.h

enum MemoryPressure
Name Value
kUnknown 0
kLow 1
kMedium 2
kHigh 3

Defined at line 19 of file ../../src/storage/f2fs/memory_watcher.h

enum MemoryStatus
Name Value
kNeedReclaim 0
kNeedCheckpoint 1
kNeedWriteback 2

Defined at line 26 of file ../../src/storage/f2fs/memory_watcher.h

enum AllocMode
Name Value
kLFS 0
kSSR 1

In the VictimSelPolicy->alloc_mode, there are two block allocation modes.

LFS writes data sequentially with cleaning operations.

SSR (Slack Space Recycle) reuses obsolete space without cleaning operations.

Defined at line 28 of file ../../src/storage/f2fs/segment.h

enum PageFlag
Name Value
kPageUptodate 0
kPageDirty 1
kPageWriteback 2
kPageVmoLocked 3
kPageActive 4
kPageColdData 5
kPageCommit 6
kPageSync 7
kPageFlagSize 8

Defined at line 31 of file ../../src/storage/f2fs/file_cache.h

enum XattrIndex
Name Value
kUser 1
kPosixAclAccess 2
kPosixAclDefault 3
kTrusted 4
kLustre 5
kSecurity 6
kAdvise 7
kEncryption 9
kVerity 11

Defined at line 32 of file ../../src/storage/f2fs/xattr.h

enum GcMode
Name Value
kGcCb 0
kGcGreedy 1

In the VictimSelPolicy->gc_mode, there are two gc, aka cleaning, modes.

GC_CB is based on cost-benefit algorithm.

GC_GREEDY is based on greedy algorithm.

Defined at line 33 of file ../../src/storage/f2fs/segment.h

enum VnodeSet
Name Value
kOrphan 0
kModifiedDir 1
kMax 2

Used to track orphans and modified dirs

Defined at line 34 of file ../../src/storage/f2fs/f2fs.h

enum FAdvise
Name Value
kCold 1

i_advise uses Fadvise:xxx bit. We can add additional hints later.

Defined at line 36 of file ../../src/storage/f2fs/vnode.h

enum GcType
Name Value
kBgGc 0
kFgGc 1

BG_GC means the background cleaning job.

FG_GC means the on-demand cleaning job.

Defined at line 37 of file ../../src/storage/f2fs/segment.h

enum CountType
Name Value
kWriteback 0
kDirtyDents 1
kDirtyNodes 2
kDirtyMeta 3
kDirtyData 4
kNrCountType 5

CountType for monitoring

f2fs monitors the number of several block types such as on-writeback,

dirty dentry blocks, dirty node blocks, and dirty meta blocks.

Defined at line 38 of file ../../src/storage/f2fs/superblock_info.h

enum InodeInfoFlag
Name Value
kInit 0
kActive 1
kNewInode 2
kNeedCp 3
kIncLink 4
kAclMode 5
kNoAlloc 6
kUpdateDir 7
kInlineXattr 8
kInlineData 9
kInlineDentry 10
kDataExist 11
kOrphan 12
kNoExtent 13
kSyncInode 14
kFlagSize 15

InodeInfo->flags keeping only in memory

Defined at line 41 of file ../../src/storage/f2fs/vnode.h

enum XattrOption
Name Value
kNone 0x0
kCreate 0x1
kReplace 0x2

Defined at line 44 of file ../../src/storage/f2fs/xattr.h

enum NodeType
Name Value
kTypeInode 37
kTypeDirectNode 43
kTypeIndirectNode 53
kTypeDoubleIndirectNode 67

Defined at line 55 of file ../../src/storage/f2fs/fsck.h

enum SegType
Name Value
kSegTypeData 0
kSegTypeCurData 1
kSegTypeNode 2
kSegTypeCurNode 3
kSegTypeMax 4

Defined at line 62 of file ../../src/storage/f2fs/fsck.h

enum CursegType
Name Value
kCursegHotData 0
kCursegWarmData 1
kCursegColdData 2
kCursegHotNode 3
kCursegWarmNode 4
kCursegColdNode 5
kNoCheckType 6

Defined at line 69 of file ../../src/storage/f2fs/layout.h

enum DirtyType
Name Value
kDirtyHotData 0
kDirtyWarmData 1
kDirtyColdData 2
kDirtyHotNode 3
kDirtyWarmNode 4
kDirtyColdNode 5
kDirty 6
kPre 7
kNrDirtytype 8

Notice: The order of dirty type is same with CursegType::XXX

Defined at line 91 of file ../../src/storage/f2fs/segment.h

enum CpFlag
Name Value
kCpCrcRecoveryFlag 0x40
kCpErrorFlag 0x8
kCpCompactSumFlag 0x4
kCpOrphanPresentFlag 0x2
kCpUmountFlag 0x1

For checkpoint

Defined at line 120 of file ../../src/storage/f2fs/layout.h

enum PageType
Name Value
kData 0
kNode 1
kMeta 2
kNrPageType 3
kMetaFlush 4

The below are the page types.

The available types are:

kData User data pages. It operates as async mode.

kNode Node pages. It operates as async mode.

kMeta FS metadata pages such as SIT, NAT, CP.

kNrPageType The number of page types.

kMetaFlush Make sure the previous pages are written

with waiting the bio's completion

... Only can be used with META.

Defined at line 130 of file ../../src/storage/f2fs/common.h

enum BitShift
Name Value
kColdBitShift 0
kFsyncBitShift 1
kDentBitShift 2
kOffsetBitShift 3

Defined at line 240 of file ../../src/storage/f2fs/layout.h

enum JournalType
Name Value
kNatJournal 0
kSitJournal 1

frequently updated NAT/SIT entries can be stored in the spare area in

summary blocks

Defined at line 362 of file ../../src/storage/f2fs/layout.h

enum FileType
Name Value
kFtUnknown 0
kFtRegFile 1
kFtDir 2
kFtChrdev 3
kFtBlkdev 4
kFtFifo 5
kFtSock 6
kFtSymlink 7
kFtMax 8
kFtOrphan 9

file types used in InodeInfo->flags

Defined at line 447 of file ../../src/storage/f2fs/layout.h

Records

Functions

  • f2fs_hash_t DentryHash (std::string_view name)

    Defined at line 12 of file ../../src/storage/f2fs/dir_hash.cc

  • uint32_t StartNid (uint32_t nid)

    start node id of a node block dedicated to the given node id

    Defined at line 24 of file ../../src/storage/f2fs/node.h

  • zx::result<std::unique_ptr<Superblock>> LoadSuperblock (BcacheMapper & bc)

    Defined at line 54 of file ../../src/storage/f2fs/f2fs.cc

  • void TEATransform (unsigned int[4] buf, const unsigned int[] in)

    Defined at line 34 of file ../../src/storage/f2fs/third_party/ext2_hash/hash.cc

  • void Str2HashBuf (const char * msg, int len, unsigned int * buf, int num)

    Defined at line 52 of file ../../src/storage/f2fs/third_party/ext2_hash/hash.cc

  • zx::result<> StartComponent (fidl::ServerEnd<fuchsia_io::Directory> root, fidl::ServerEnd<fuchsia_process_lifecycle::Lifecycle> lifecycle)

    Defined at line 17 of file ../../src/storage/f2fs/mount.cc

  • uint32_t XattrSlots (size_t size)

    Defined at line 24 of file ../../src/storage/f2fs/xattr.h

  • void AsciiToUnicode (std::string_view in_string, std::u16string & out_string)

    Defined at line 31 of file ../../src/storage/f2fs/mkfs.cc

  • size_t CountBits (const RawBitmap & bits, size_t offset, size_t len)

    Defined at line 13 of file ../../src/storage/f2fs/bitmap.cc

  • int NatsInCursum (const SummaryBlock & sum)

    Defined at line 16 of file ../../src/storage/f2fs/superblock_info.h

  • int SitsInCursum (const SummaryBlock & sum)

    Defined at line 17 of file ../../src/storage/f2fs/superblock_info.h

  • RawNatEntry NatInJournal (const SummaryBlock & sum, int i)

    Defined at line 19 of file ../../src/storage/f2fs/superblock_info.h

  • void SetNatInJournal (SummaryBlock & sum, int i, RawNatEntry & raw_ne)

    Defined at line 20 of file ../../src/storage/f2fs/superblock_info.h

  • nid_t NidInJournal (const SummaryBlock & sum, int i)

    Defined at line 23 of file ../../src/storage/f2fs/superblock_info.h

  • void SetNidInJournal (SummaryBlock & sum, int i, nid_t nid)

    Defined at line 24 of file ../../src/storage/f2fs/superblock_info.h

  • zx::result<std::unique_ptr<BcacheMapper>> CreateBcacheMapper (std::vector<std::unique_ptr<block_client::BlockDevice>> devices, bool allocate)

    It actually creates BcacheMapper on underlying |devices|.

    It tries to allocate slices on fvm If |allocate| is set.

    Defined at line 25 of file ../../src/storage/f2fs/bcache.cc

  • SitEntry & SitInJournal (SummaryBlock & sum, int i)

    Defined at line 26 of file ../../src/storage/f2fs/superblock_info.h

  • uint64_t NatBlockOffset (uint32_t start_nid)

    node block offset on the NAT area dedicated to the given start node id

    Defined at line 27 of file ../../src/storage/f2fs/node.h

  • uint32_t SegnoInJournal (const SummaryBlock & sum, int i)

    Defined at line 27 of file ../../src/storage/f2fs/superblock_info.h

  • void SetSegnoInJournal (SummaryBlock & sum, int i, uint32_t segno)

    Defined at line 30 of file ../../src/storage/f2fs/superblock_info.h

  • template <typename T = uint8_t>
    T GetMask (const T value, const size_t offset)

    Defined at line 56 of file ../../src/storage/f2fs/bitmap.h

  • bool IsValidNameLength (std::string_view name)

    Defined at line 60 of file ../../src/storage/f2fs/vnode.h

  • size_t GetBitSize (size_t size_in_byte)

    Defined at line 60 of file ../../src/storage/f2fs/bitmap.h

  • void SetDirEntryType (DirEntry & de, VnodeF2fs & vnode)

    Defined at line 61 of file ../../src/storage/f2fs/dir.cc

  • CursegType GetSegmentType (Page & page, PageType p_type, size_t num_logs)

    Defined at line 60 of file ../../src/storage/f2fs/segment.cc

  • uint16_t LeToCpu (uint16_t x)

    Defined at line 62 of file ../../src/storage/f2fs/common.h

  • uint32_t LeToCpu (uint32_t x)

    Defined at line 63 of file ../../src/storage/f2fs/common.h

  • uint64_t LeToCpu (uint64_t x)

    Defined at line 64 of file ../../src/storage/f2fs/common.h

  • size_t GetByteSize (size_t num_bits)

    Defined at line 64 of file ../../src/storage/f2fs/bitmap.h

  • uint16_t CpuToLe (uint16_t x)

    Defined at line 65 of file ../../src/storage/f2fs/common.h

  • uint64_t DirBlockIndex (uint32_t level, uint8_t dir_level, uint32_t idx)

    Defined at line 65 of file ../../src/storage/f2fs/dir.cc

  • uint32_t CpuToLe (uint32_t x)

    Defined at line 66 of file ../../src/storage/f2fs/common.h

  • uint64_t CpuToLe (uint64_t x)

    Defined at line 67 of file ../../src/storage/f2fs/common.h

  • size_t ToMsbFirst (size_t offset)

    Defined at line 68 of file ../../src/storage/f2fs/bitmap.h

  • size_t GetOfsInDnode (NodePath & path)

    Defined at line 75 of file ../../src/storage/f2fs/node.h

  • zx_status_t bitcpy (uint8_t * dst, const uint8_t * src, size_t offset, size_t len)

    It copies bits from [0, len) of |src| to [offset, offset + len) of |dst|.

    |offset| + |len| and |len| must be multiples of 8.

    Defined at line 75 of file ../../src/storage/f2fs/bitmap.h

  • CursegType operator+ (CursegType a, uint32_t && b)

    Defined at line 82 of file ../../src/storage/f2fs/fsck.cc

  • template <typename T = RawBitmap>
    zx_status_t CloneBits (T & to, const T & from, size_t offset, size_t len)

    Defined at line 87 of file ../../src/storage/f2fs/bitmap.h

  • bool VerAfter (uint64_t a, uint64_t b)

    Checkpoint

    Defined at line 91 of file ../../src/storage/f2fs/common.h

  • bool IsValidBlockAddr (block_t addr)

    Defined at line 93 of file ../../src/storage/f2fs/common.h

  • uint32_t F2fsCalCrc32 (uint32_t crc, void * buff, uint32_t len)

    CRC

    Defined at line 96 of file ../../src/storage/f2fs/common.h

  • template <typename T = RawBitmap>
    zx_status_t CloneBits (T & to, const void * from, size_t offset, size_t len)

    Defined at line 98 of file ../../src/storage/f2fs/bitmap.h

  • zx::result<std::unique_ptr<BcacheMapper>> CreateBcacheMapper (fidl::ClientEnd<fuchsia_storage_block::Block> device, bool allocate)

    for the startup service

    Defined at line 111 of file ../../src/storage/f2fs/bcache.cc

  • zx::result<std::unique_ptr<BcacheMapper>> CreateBcacheMapper (std::unique_ptr<block_client::BlockDevice> device, bool allocate)

    for test

    Defined at line 104 of file ../../src/storage/f2fs/bcache.cc

  • uint32_t F2fsCrc32 (void * buff, uint32_t len)

    Defined at line 106 of file ../../src/storage/f2fs/common.h

  • bool F2fsCrcValid (uint32_t blk_crc, void * buff, uint32_t buff_size)

    Defined at line 110 of file ../../src/storage/f2fs/common.h

  • int LookupJournalInCursum (SummaryBlock & sum, JournalType type, uint32_t val, int alloc)

    Defined at line 110 of file ../../src/storage/f2fs/segment.cc

  • int UpdateNatsInCursum (SummaryBlock & raw_summary, int i)

    Defined at line 98 of file ../../src/storage/f2fs/segment.cc

  • template <typename T = RawBitmap>
    zx_status_t CloneBits (void * to, const T & from, size_t offset, size_t len)

    Defined at line 109 of file ../../src/storage/f2fs/bitmap.h

  • bool IsDotOrDotDot (std::string_view name)

    Defined at line 114 of file ../../src/storage/f2fs/common.h

  • template <typename T>
    T CheckedDivRoundUp (const T n, const T d)

    Defined at line 117 of file ../../src/storage/f2fs/common.h

  • block_t SitBlockOffset (uint32_t segno)

    Defined at line 125 of file ../../src/storage/f2fs/segment.h

  • block_t StartSegNo (uint32_t segno)

    Defined at line 126 of file ../../src/storage/f2fs/segment.h

  • bool IsDataSeg (const CursegType t)

    Defined at line 127 of file ../../src/storage/f2fs/segment.h

  • bool IsNodeSeg (const CursegType t)

    Defined at line 131 of file ../../src/storage/f2fs/segment.h

  • void SetSummary (Summary * sum, nid_t nid, size_t ofs_in_node, uint8_t version)

    Defined at line 135 of file ../../src/storage/f2fs/segment.h

  • std::shared_mutex & GetGlobalLock ()

    It should be acquired in shared mode before any operations modifying data and metadata (i.e.,

    data, node and meta blocks). GC and checkpoint acquire it exclusively.

    Defined at line 194 of file ../../src/storage/f2fs/common.h

  • uint16_t GetSitVblocks (const SitEntry & raw_sit)

    Defined at line 304 of file ../../src/storage/f2fs/layout.h

  • uint8_t GetSitType (const SitEntry & raw_sit)

    Defined at line 307 of file ../../src/storage/f2fs/layout.h

  • uint8_t GetSumType (SummaryFooter * footer)

    Defined at line 357 of file ../../src/storage/f2fs/layout.h

  • void SetSumType (SummaryFooter * footer, uint8_t type)

    Defined at line 358 of file ../../src/storage/f2fs/layout.h

  • uint16_t GetDentrySlots (uint16_t namelen)

    Defined at line 414 of file ../../src/storage/f2fs/layout.h

  • zx_status_t ParseOptions (const MkfsOptions & options)

    Defined at line 774 of file ../../src/storage/f2fs/mkfs.cc

  • zx::result<std::unique_ptr<BcacheMapper>> Mkfs (const MkfsOptions & options, std::unique_ptr<BcacheMapper> bc)

    Defined at line 790 of file ../../src/storage/f2fs/mkfs.cc

  • zx_status_t Fsck (std::unique_ptr<BcacheMapper> bcconst FsckOptions & optionsstd::unique_ptr<BcacheMapper> * out)

    Defined at line 2033 of file ../../src/storage/f2fs/fsck.cc

Variables

const unsigned char[] kFiletypeTable

Defined at line 23 of file ../../src/storage/f2fs/dir.cc