ext4_find_near(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ ext4_find_near(9) ✨

okay bestie so this is a page from the Kernel API Manual β€” yes, the kernel has a manual, we're literally living in the future πŸ’… β€” and it's about ext4_find_near, a lil ext4 helper that goes "where should this new block live tho?"


πŸŽ€ NAME πŸŽ€

ext4_find_near β€” find a place for allocation with sufficient locality

like, vibes-based real estate for disk blocks 🏑✨


πŸ¦‹ SYNOPSIS πŸ¦‹

ext4_fsblk_t ext4_find_near (struct inode *inode , Indirect *ind );

🌸 ARGUMENTS 🌸

  • inode β€” the owner. the main character of this whole situation πŸ‘‘
  • ind β€” descriptor of indirect block. (yes that's the whole description, it's giving minimalism 🫢)

πŸ’– DESCRIPTION πŸ’–

so this function returns the preferred place for block allocation. it's used when the heuristic for sequential allocation fails β€” i.e. when the cute "just put the next one right after the last one" plan doesn't work out 😭.

the rules are, and we stan a rules-based queen:

  • if there is a block to the left of our position β€” allocate near it.
  • if the pointer will live in an indirect block β€” allocate near that block.
  • if the pointer will live in the inode β€” allocate in the same cylinder group.

in that last case, we colour the starting block by the caller's PID to prevent it from clashing with concurrent allocations for a different inode in the same block group. the PID is used here so that functionally related files will be close-by on-disk. like, we keep the friend group together on the dancefloor πŸ•ΊπŸ’ƒ no cap.

⚠️ caller must make sure that ind is valid and will stay that way. literally your job bestie, not ours πŸ™ˆ

πŸ”₯ SEE ALSO πŸ”₯

the whole indirect.c friend group, honestly. go read them all, iykyk 🌈


okay that's the page!! source/version is ./fs/ext4, dated October 2026, and the title/header thing was ext4_find_near(9) from the Kernel API Manual β€” mwah, go allocate responsibly, slay πŸ’œπŸ§šβ€β™€οΈβ­

πŸ“¦ where this page comes from