check_leaf(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… check_leaf(9) β€” the kernel API manual, bestie edition πŸŽ€

okay so this is check_leaf, from section 9 of the Kernel API Manual, and honestly? she's a little workhorse and she deserves her flowers 🌸


✨ NAME ✨

check_leaf β€” check leaf node. that's it, that's the vibe. a leaf node inspector πŸ“


πŸ¦‹ SYNOPSIS πŸ¦‹

int check_leaf (struct ubifs_info *c , struct ubifs_zbranch *zbr , void
*priv );

πŸ’– ARGUMENTS πŸ’–

  • c β€” the UBIFS file-system description object. your whole filesystem's little personality profile, basically πŸ’œ
  • zbr β€” the zbranch of the leaf node we're checking. like, this specific leaf, bestie πŸƒ
  • priv β€” FS checking information. the private stash of info the checker carries around πŸŽ€

πŸ”₯ DESCRIPTION πŸ”₯

okay so real talk β€” this is a helper function for dbg_check_filesystem, and it gets called for every single leaf node while walking the indexing tree. every. single. one. no skipping, no cap πŸ™ˆ

here's what she's checking when she shows up:

  • that the leaf node referred from the indexing tree actually exists β€” like, hello?? are you real?? πŸ‘€
  • that it has the correct CRC β€” integrity check, periodt ✨
  • and she does some other basic validation too, because she's thorough like that πŸ’…

and she's not just a bouncer, she's also a builder 🧚 β€” this function is responsible for building an RB-tree of inodes, and it adds all the inodes into that RB-tree. every one.

on top of that, she calculates the reference count, size, etc. for each inode, so that later on those numbers can be compared against the info stored inside the inodes themselves and any possible inconsistencies get caught. detective energy, lowkey πŸ”

returns zero in case of success and a negative error code in case of failure. so like, 0 = slay, negative = something's off 😭


🌈 SEE ALSO 🌈

the kernel file ./fs/ubifs/debug.c, plus this whole friend group right here β€” they all come as a set, iykyk:


ngl bestie, if you're poking at leaf nodes you're already deep in the UBIFS debugging trenches β€” read the whole list, they're all neighbours πŸ‘‘

and that's the page! 🫢 this one lives in ./fs/ubifs, dated October 2026 β€” mark your calendar, she's iconic πŸ‘‘β­

πŸ“¦ where this page comes from