STRUCT UBIFS_INFO(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay bestie, buckle up β€” this is struct ubifs_info(9) from the Kernel API Manual, and it is a whole mood. Think of it as the UBIFS file-system description data structure (per-superblock) β€” yes, one of these per superblock, main character energy fr fr.


πŸ’– NAME πŸ’–

struct ubifs_info β€” the UBIFS file-system description data structure (per-superblock).


✨ SYNOPSIS ✨

here's the whole struct, copied exactly so you can vibe-check every single member β€” no cap, we are not skipping anything:

       struct ubifs_info {
           struct super_block *vfs_sb;
           struct ubifs_sb_node *sup_node;
           ino_t highest_inum;
           unsigned long long max_sqnum;
           unsigned long long cmt_no;
           spinlock_t cnt_lock;
           int fmt_version;
           int ro_compat_version;
           unsigned char uuid[16];
           int lhead_lnum;
           int lhead_offs;
           int ltail_lnum;
           struct mutex log_mutex;
           int min_log_bytes;
           long long cmt_bud_bytes;
           struct rb_root buds;
           long long bud_bytes;
           spinlock_t buds_lock;
           int jhead_cnt;
           struct ubifs_jhead *jheads;
           long long max_bud_bytes;
           long long bg_bud_bytes;
           struct list_head old_buds;
           int max_bud_cnt;
           atomic_t need_wait_space;
           wait_queue_head_t reserve_space_wq;
           struct rw_semaphore commit_sem;
           int cmt_state;
           spinlock_t cs_lock;
           wait_queue_head_t cmt_wq;
           struct kobject kobj;
           struct completion kobj_unregister;
           unsigned int big_lpt:1;
           unsigned int space_fixup:1;
           unsigned int double_hash:1;
           unsigned int encrypted:1;
           unsigned int no_chk_data_crc:1;
           unsigned int bulk_read:1;
           unsigned int default_compr:2;
           unsigned int rw_incompat:1;
           unsigned int assert_action:2;
           unsigned int authenticated:1;
           unsigned int superblock_need_write:1;
           struct mutex tnc_mutex;
           struct ubifs_zbranch zroot;
           struct ubifs_znode *cnext;
           struct ubifs_znode *enext;
           int *gap_lebs;
           void *cbuf;
           void *ileb_buf;
           int ileb_len;
           int ihead_lnum;
           int ihead_offs;
           int *ilebs;
           int ileb_cnt;
           int ileb_nxt;
           struct rb_root old_idx;
           int *bottom_up_buf;
           struct ubifs_mst_node *mst_node;
           int mst_offs;
           int max_bu_buf_len;
           struct mutex bu_mutex;
           struct bu_info bu;
           struct mutex write_reserve_mutex;
           void *write_reserve_buf;
           int log_lebs;
           long long log_bytes;
           int log_last;
           int lpt_lebs;
           int lpt_first;
           int lpt_last;
           int orph_lebs;
           int orph_first;
           int orph_last;
           int main_lebs;
           int main_first;
           long long main_bytes;
           uint8_t key_hash_type;
           uint32_t (*key_hash)(const char *str, int len);
           int key_fmt;
           int key_len;
           int hash_len;
           int fanout;
           int min_io_size;
           int min_io_shift;
           int max_write_size;
           int max_write_shift;
           int leb_size;
           int leb_start;
           int half_leb_size;
           int idx_leb_size;
           int leb_cnt;
           int max_leb_cnt;
           unsigned int ro_media:1;
           unsigned int ro_mount:1;
           unsigned int ro_error:1;
           atomic_long_t dirty_pg_cnt;
           atomic_long_t dirty_zn_cnt;
           atomic_long_t clean_zn_cnt;
           spinlock_t space_lock;
           struct ubifs_lp_stats lst;
           struct ubifs_budg_info bi;
           unsigned long long calc_idx_sz;
           int ref_node_alsz;
           int mst_node_alsz;
           int min_idx_node_sz;
           int max_idx_node_sz;
           long long max_inode_sz;
           int max_znode_sz;
           int leb_overhead;
           int dead_wm;
           int dark_wm;
           int block_cnt;
           struct ubifs_node_range ranges[UBIFS_NODE_TYPES_CNT];
           struct ubi_volume_desc *ubi;
           struct ubi_device_info di;
           struct ubi_volume_info vi;
           struct rb_root orph_tree;
           struct list_head orph_list;
           struct list_head orph_new;
           struct ubifs_orphan *orph_cnext;
           struct ubifs_orphan *orph_dnext;
           spinlock_t orphan_lock;
           void *orph_buf;
           int new_orphans;
           int cmt_orphans;
           int tot_orphans;
           int max_orphans;
           int ohead_lnum;
           int ohead_offs;
           int no_orphs;
           struct task_struct *bgt;
           char bgt_name[sizeof(BGT_NAME_PATTERN) + 9];
           int need_bgt;
           int need_wbuf_sync;
           int gc_lnum;
           void *sbuf;
           struct list_head idx_gc;
           int idx_gc_cnt;
           int gc_seq;
           int gced_lnum;
           struct list_head infos_list;
           struct mutex umount_mutex;
           unsigned int shrinker_run_no;
           int space_bits;
           int lpt_lnum_bits;
           int lpt_offs_bits;
           int lpt_spc_bits;
           int pcnt_bits;
           int lnum_bits;
           int nnode_sz;
           int pnode_sz;
           int ltab_sz;
           int lsave_sz;
           int pnode_cnt;
           int nnode_cnt;
           int lpt_hght;
           int pnodes_have;
           struct mutex lp_mutex;
           int lpt_lnum;
           int lpt_offs;
           int nhead_lnum;
           int nhead_offs;
           int lpt_drty_flgs;
           int dirty_nn_cnt;
           int dirty_pn_cnt;
           int check_lpt_free;
           long long lpt_sz;
           void *lpt_nod_buf;
           void *lpt_buf;
           struct ubifs_nnode *nroot;
           struct ubifs_cnode *lpt_cnext;
           struct ubifs_lpt_heap lpt_heap[LPROPS_HEAP_CNT];
           struct ubifs_lpt_heap dirty_idx;
           struct list_head uncat_list;
           struct list_head empty_list;
           struct list_head freeable_list;
           struct list_head frdi_idx_list;
           int freeable_cnt;
           int in_a_category_cnt;
           int ltab_lnum;
           int ltab_offs;
           struct ubifs_lpt_lprops *ltab;
           struct ubifs_lpt_lprops *ltab_cmt;
           int lsave_cnt;
           int lsave_lnum;
           int lsave_offs;
           int *lsave;
           int lscan_lnum;
           long long rp_size;
           long long report_rp_size;
           kuid_t rp_uid;
           kgid_t rp_gid;
           struct crypto_shash *hash_tfm;
           struct crypto_shash *hmac_tfm;
           int hmac_desc_len;
           char *auth_key_name;
           char *auth_hash_name;
           enum hash_algo auth_hash_algo;
           struct shash_desc *log_hash;
           unsigned int empty:1;
           unsigned int need_recovery:1;
           unsigned int replaying:1;
           unsigned int mounting:1;
           unsigned int remounting_rw:1;
           unsigned int probing:1;
           struct list_head replay_list;
           struct list_head replay_buds;
           unsigned long long cs_sqnum;
           struct list_head unclean_leb_list;
           struct ubifs_mst_node *rcvrd_mst_node;
           struct rb_root size_tree;
           struct ubifs_mount_opts mount_opts;
           struct ubifs_debug_info *dbg;
           struct ubifs_stats_info *stats;
        };

🫢 Members 🫢

okay so this is the part where every single field gets its little explanation. we are not skipping any β€” this is a full send.

  • vfs_sb β€” the VFS struct super_block object. iconic handshake with the VFS.
  • sup_node β€” the super block node as read from the device.
  • highest_inum β€” highest used inode number.
  • max_sqnum β€” current global sequence number.
  • cmt_no β€” commit number of the last successfully completed commit, protected by commit_sem.
  • cnt_lock β€” protects highest_inum and max_sqnum counters.
  • fmt_version β€” UBIFS on-flash format version.
  • ro_compat_version β€” R/O compatibility version.
  • uuid β€” UUID from super block.
  • lhead_lnum β€” log head logical eraseblock number.
  • lhead_offs β€” log head offset.
  • ltail_lnum β€” log tail logical eraseblock number (offset is always 0). zero, bestie.
  • log_mutex β€” protects the log, lhead_lnum, lhead_offs, ltail_lnum, and bud_bytes.
  • min_log_bytes β€” minimum required number of bytes in the log.
  • cmt_bud_bytes β€” used during commit to temporarily amount of bytes in committed buds.
  • buds β€” tree of all buds indexed by bud LEB number.
  • bud_bytes β€” how many bytes of flash is used by buds.
  • buds_lock β€” protects the buds tree, bud_bytes, and per-journal head bud lists.
  • jhead_cnt β€” count of journal heads.
  • jheads β€” journal heads (head zero is base head).
  • max_bud_bytes β€” maximum number of bytes allowed in buds.
  • bg_bud_bytes β€” number of bud bytes when background commit is initiated.
  • old_buds β€” buds to be released after commit ends.
  • max_bud_cnt β€” maximum number of buds.
  • need_wait_space β€” Non 0 means space reservation tasks need to wait in queue.
  • reserve_space_wq β€” wait queue to sleep on if need_wait_space is not 0.
  • commit_sem β€” synchronizes committer with other processes.
  • cmt_state β€” commit state.
  • cs_lock β€” commit state lock.
  • cmt_wq β€” wait queue to sleep on if the log is full and a commit is running.
  • kobj β€” kobject for /sys/fs/ubifs/.
  • kobj_unregister β€” completion to unregister sysfs kobject.
  • big_lpt β€” flag that LPT is too big to write whole during commit.
  • space_fixup β€” flag indicating that free space in LEBs needs to be cleaned up.
  • double_hash β€” flag indicating that we can do lookups by hash.
  • encrypted β€” flag indicating that this file system contains encrypted files.
  • no_chk_data_crc β€” do not check CRCs when reading data nodes (except during recovery). read the exception, bestie.
  • bulk_read β€” enable bulk-reads.
  • default_compr β€” default compression algorithm (UBIFS_COMPR_LZO, etc).
  • rw_incompat β€” the media is not R/W compatible. not R/W compatible, so do not play with it like it is.
  • assert_action β€” action to take when a ubifs_assert fails.
  • authenticated β€” flag indicating the FS is mounted in authenticated mode.
  • superblock_need_write β€” superblock node needs to be written.
  • tnc_mutex β€” protects the Tree Node Cache (TNC), zroot, cnext, enext, and calc_idx_sz.
  • zroot β€” zbranch which points to the root index node and znode.
  • cnext β€” next znode to commit.
  • enext β€” next znode to commit to empty space.
  • gap_lebs β€” array of LEBs used by the in-gaps commit method.
  • cbuf β€” commit buffer.
  • ileb_buf β€” buffer for commit in-the-gaps method.
  • ileb_len β€” length of data in ileb_buf.
  • ihead_lnum β€” LEB number of index head.
  • ihead_offs β€” offset of index head.
  • ilebs β€” pre-allocated index LEBs.
  • ileb_cnt β€” number of pre-allocated index LEBs.
  • ileb_nxt β€” next pre-allocated index LEBs.
  • old_idx β€” tree of index nodes obsoleted since the last commit start.
  • bottom_up_buf β€” a buffer which is used by dirty_cow_bottom_up in tnc.c. iykyk.
  • mst_node β€” master node.
  • mst_offs β€” offset of valid master node.
  • max_bu_buf_len β€” maximum bulk-read buffer length.
  • bu_mutex β€” protects the pre-allocated bulk-read buffer and c->bu.
  • bu β€” pre-allocated bulk-read information.
  • write_reserve_mutex β€” protects write_reserve_buf.
  • write_reserve_buf β€” bestie, on the write path we allocate memory, and sometimes the memory is just not there 😭 so we use this write reserve buffer instead. lowkey a safety net.
  • log_lebs β€” the number of logical eraseblocks chilling in the log ✨
  • log_bytes β€” the log size in bytes, exactly.
  • log_last β€” the last LEB of the log, periodt.
  • lpt_lebs β€” how many LEBs the lprops table is using.
  • lpt_first β€” first LEB of the lprops table area πŸŽ€
  • lpt_last β€” last LEB of the lprops table area πŸŽ€
  • orph_lebs β€” the number of LEBs used for the orphan area (yes it's giving orphan era πŸ’€)
  • orph_first β€” first LEB of the orphan area
  • orph_last β€” last LEB of the orphan area
  • main_lebs β€” count of LEBs in the main area, the main character obviously πŸ‘‘
  • main_first β€” first LEB of the main area
  • main_bytes β€” main area size in bytes πŸ’–
  • key_hash_type β€” the type of the key hash
  • key_hash β€” the direntry key hash function
  • key_fmt β€” key format
  • key_len β€” key length
  • hash_len β€” the length of the index node hashes ✨
  • fanout β€” fanout of the index tree, aka the number of links per indexing node
  • min_io_size β€” minimal input/output unit size
  • min_io_shift β€” number of bits in min_io_size minus one
  • max_write_size β€” the maximum amount of bytes the underlying flash can write at a time (that's the MTD write buffer size, iykyk)
  • max_write_shift β€” number of bits in max_write_size minus one
  • leb_size β€” logical eraseblock size in bytes, iconic ✨
  • leb_start β€” the starting offset of logical eraseblocks within physical eraseblocks
  • half_leb_size β€” half LEB size (math ate πŸ’…)
  • idx_leb_size β€” how many bytes of an LEB are effectively available when it's used to store indexing nodes, which is leb_size - max_idx_node_sz
  • leb_cnt β€” count of logical eraseblocks
  • max_leb_cnt β€” maximum count of logical eraseblocks
  • ro_media β€” the underlying UBI volume is read-only
  • ro_mount β€” the file-system was mounted as read-only
  • ro_error β€” UBIFS switched to R/O mode because an error happened 😭 no cap, that's bad news
  • dirty_pg_cnt β€” number of dirty pages (not used β€” she's just vibing there, unused πŸ™ˆ)
  • dirty_zn_cnt β€” number of dirty znodes
  • clean_zn_cnt β€” number of clean znodes ✨
  • space_lock β€” this one protects bi and lst 🫢
  • lst β€” lprops statistics
  • bi β€” budgeting information
  • calc_idx_sz β€” temporary variable used to calculate the new index size (and it contains the accurate new index size at end of TNC commit start, fr fr)
  • ref_node_alsz β€” size of the LEB reference node aligned to the min. flash I/O unit
  • mst_node_alsz β€” master node aligned size
  • min_idx_node_sz β€” minimum indexing node aligned on 8-bytes boundary
  • max_idx_node_sz β€” maximum indexing node aligned on 8-bytes boundary
  • max_inode_sz β€” maximum possible inode size in bytes
  • max_znode_sz β€” size of znode in bytes
  • leb_overhead β€” how many bytes are wasted in an LEB when it's filled with data nodes of maximum size β€” used in free space reporting πŸ’€ wasted bytes, we hate to see it
  • dead_wm β€” LEB dead space watermark
  • dark_wm β€” LEB dark space watermark
  • block_cnt β€” count of 4KiB blocks on the FS
  • ranges β€” UBIFS node length ranges
  • ubi β€” UBI volume descriptor
  • di β€” UBI device information
  • vi β€” UBI volume information
  • orph_tree β€” rb-tree of orphan inode numbers 🌳
  • orph_list β€” list of orphan inode numbers in order added
  • orph_new β€” list of orphan inode numbers added since last commit
  • orph_cnext β€” next orphan to commit
  • orph_dnext β€” next orphan to delete
  • orphan_lock β€” the lock for orph_tree and orph_new πŸ”’
  • orph_buf β€” buffer for orphan nodes
  • new_orphans β€” number of orphans since last commit
  • cmt_orphans β€” number of orphans being committed
  • tot_orphans β€” number of orphans in the rb_tree
  • max_orphans β€” maximum number of orphans allowed
  • ohead_lnum β€” orphan head LEB number
  • ohead_offs β€” orphan head offset
  • no_orphs β€” non-zero if there are no orphans (so like, the opposite of what the name sounds like, iykyk πŸ™ˆ)
  • bgt β€” the UBIFS background thread 🧡
  • bgt_name β€” background thread name
  • need_bgt β€” set if the background thread should run
  • need_wbuf_sync β€” set if write-buffers have to be synchronized
  • gc_lnum β€” LEB number used for garbage collection ♻️
  • sbuf β€” a buffer of LEB size used by GC and replay for scanning
  • idx_gc β€” list of index LEBs that have been garbage collected
  • idx_gc_cnt β€” number of elements on the idx_gc list
  • gc_seq β€” incremented for every non-index LEB garbage collected
  • gced_lnum β€” last non-index LEB that was garbage collected
  • infos_list β€” links all ubifs_info objects together 🫢
  • umount_mutex β€” serializes shrinker and un-mount, no cutting the line bestie πŸ’…
  • shrinker_run_no β€” shrinker run number
  • space_bits β€” number of bits needed to record free or dirty space
  • lpt_lnum_bits β€” number of bits needed to record a LEB number in the LPT
  • lpt_offs_bits β€” number of bits needed to record an offset in the LPT
  • lpt_spc_bits β€” number of bits needed to record space in the LPT
  • pcnt_bits β€” number of bits needed to record pnode or nnode number
  • lnum_bits β€” number of bits needed to record LEB number
  • nnode_sz β€” size of on-flash nnode
  • pnode_sz β€” size of on-flash pnode
  • ltab_sz β€” size of on-flash LPT lprops table
  • lsave_sz β€” size of on-flash LPT save table
  • pnode_cnt β€” number of pnodes
  • nnode_cnt β€” number of nnodes
  • lpt_hght β€” height of the LPT
  • pnodes_have β€” number of pnodes in memory 🧠
  • lp_mutex β€” protects the lprops table and all the other lprops-related fields
  • lpt_lnum β€” LEB number of the root nnode of the LPT
  • lpt_offs β€” offset of the root nnode of the LPT
  • nhead_lnum β€” LEB number of LPT head
  • nhead_offs β€” offset of LPT head
  • lpt_drty_flgs β€” dirty flags for LPT special nodes, e.g. ltab
  • dirty_nn_cnt β€” number of dirty nnodes
  • dirty_pn_cnt β€” number of dirty pnodes
  • check_lpt_free β€” flag that indicates LPT GC may be needed πŸ‘€
  • lpt_sz β€” LPT size
  • lpt_nod_buf β€” buffer for an on-flash nnode or pnode
  • lpt_buf β€” buffer of LEB size used by LPT
  • nroot β€” address in memory of the root nnode of the LPT
  • lpt_cnext β€” next LPT node to commit
  • lpt_heap β€” array of heaps of categorized lprops ⛰️
  • dirty_idx β€” a (reverse sorted) copy of the LPROPS_DIRTY_IDX heap as at previous commit start
  • uncat_list β€” list of un-categorized LEBs
  • empty_list β€” list of empty LEBs
  • freeable_list β€” list of freeable non-index LEBs (free + dirty == leb_size)
  • frdi_idx_list β€” list of freeable index LEBs (free + dirty == leb_size)
  • freeable_cnt β€” number of freeable LEBs in freeable_list
  • in_a_category_cnt β€” count of lprops which are in a certain category, which basically meants that they were loaded from the flash (yes "meants", we keep it exactly as it is, icon behavior πŸ’…)
  • ltab_lnum β€” LEB number of LPT's own lprops table
  • ltab_offs β€” offset of LPT's own lprops table
  • ltab β€” LPT's own lprops table
  • ltab_cmt β€” LPT's own lprops table (commit copy)
  • lsave_cnt β€” number of LEB numbers in LPT's save table
  • lsave_lnum β€” LEB number of LPT's save table
  • lsave_offs β€” offset of LPT's save table
  • lsave β€” LPT's save table
  • lscan_lnum β€” LEB number of last LPT scan
  • rp_size β€” size of the reserved pool in bytes
  • report_rp_size β€” size of the reserved pool reported to user-space
  • rp_uid β€” reserved pool user ID
  • rp_gid β€” reserved pool group ID
  • hash_tfm β€” the hash transformation used for hashing nodes
  • hmac_tfm β€” the HMAC transformation for this filesystem
  • hmac_desc_len β€” length of the HMAC used for authentication πŸ”
  • auth_key_name β€” the authentication key name
  • auth_hash_name β€” the name of the hash algorithm used for authentication
  • auth_hash_algo β€” the authentication hash used for this fs
  • log_hash β€” the log hash from the commit start node up to the latest reference node
  • empty β€” 1 if the UBI device is empty
  • need_recovery β€” 1 if the file-system needs recovery πŸš‘
  • replaying β€” 1 during journal replay
  • mounting β€” 1 while mounting
  • remounting_rw β€” 1 while re-mounting from R/O mode to R/W mode
  • probing β€” 1 while attempting to mount if the SB_SILENT mount flag is set
  • replay_list β€” temporary list used during journal replay
  • replay_buds β€” list of buds to replay
  • cs_sqnum β€” sequence number of first node in the log (commit start node)
  • unclean_leb_list β€” LEBs to recover when re-mounting R/O mounted FS to R/W mode
  • rcvrd_mst_node β€” recovered master node to write when re-mounting R/O mounted FS to R/W mode
  • size_tree β€” inode size information for recovery
  • mount_opts β€” UBIFS-specific mount options
  • dbg β€” debugging-related information πŸ›
  • stats β€” statistics exported over sysfs

✨ SEE ALSO ✨

Kernel file ./fs/ubifs/ubifs.h β€” and like, go read these too bestie, they're all connected 🫢

  • struct ubifs_old_idx(9)
  • struct ubifs_scan_node(9)
  • struct ubifs_scan_leb(9)
  • struct ubifs_gced_idx_leb(9)
  • struct ubifs_inode(9)
  • struct ubifs_unclean_leb(9)
  • struct ubifs_lprops(9)
  • struct ubifs_lpt_lprops(9)
  • struct ubifs_lp_stats(9)
  • struct ubifs_cnode(9)
  • struct ubifs_pnode(9)
  • struct ubifs_nbranch(9)
  • struct ubifs_nnode(9)
  • struct ubifs_lpt_heap(9)
  • struct ubifs_wbuf(9)
  • struct ubifs_bud(9)
  • struct ubifs_jhead(9)
  • struct ubifs_zbranch(9)
  • struct ubifs_znode(9)
  • struct bu_info(9)
  • struct ubifs_node_range(9)
  • struct ubifs_compressor(9)
  • struct ubifs_budget_req(9)
  • struct ubifs_orphan(9)
  • struct ubifs_mount_opts(9)
  • struct ubifs_budg_info(9)
  • struct ubifs_stats_info(9)
  • ubifs_check_hash(9)
  • ubifs_check_hmac(9)
  • ubifs_branch_hash(9)
  • ubifs_copy_hash(9)
  • ubifs_auth_node_sz(9)

ok that's the whole struct, you actually read all of it?? obsessed with you fr πŸ’– this page lives at ./fs/ubifs, dated October 2026, and it's struct ubifs_info(9) β€” go touch some grass now bestie, you earned it πŸŒΈπŸ¦‹βœ¨
πŸ“¦ where this page comes from