nilfs_mdt_find_block(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… nilfs_mdt_find_block β€” from the Kernel API Manual, bestie πŸŽ€

Okay so grab a strawberry drink πŸ“ because we're diving into nilfs_mdt_find_block(9), a real one from the kernel API manual. She's a function, she finds blocks on a metadata file, and honestly? She ate. ✨


🌸 NAME 🌸

nilfs_mdt_find_block β€” literally just find and get a buffer on a meta data file, that's the whole vibe πŸ’–


✨ SYNOPSIS ✨

int nilfs_mdt_find_block (struct inode *inode , unsigned long start ,
       unsigned long end , unsigned long *blkoff , struct buffer_head **out_bh
);

No cap, that's the exact signature, don't come for me 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • inode β€” the inode of the meta data file, like her whole identity ngl πŸ‘‘
  • start β€” the start block offset, and yes it's inclusive (she's invited to the party)
  • end β€” the end block offset, also inclusive, she's invited too πŸ’œ
  • blkoff β€” the block offset
  • out_bh β€” the place to store a pointer to the buffer_head struct, like a lil gift bag 🎁

πŸ”₯ DESCRIPTION πŸ”₯

So nilfs_mdt_find_block looks up an existing block in the range of [start, end] β€” inclusive on both ends, we been knew β€” and then it stores a pointer to a buffer head of that block into out_bh, and the block offset into blkoff, respectively. Two little deliveries, one call πŸ’«

Lowkey important caveat bestie: out_bh and blkoff are substituted only when zero is returned. So like, don't go reading those outputs before a 0, that's not the moment πŸ™ˆ

⭐ RETURN ⭐

0 on success β€” slay, iconic, we love a clean return πŸ’… Or one of these following negative error codes on failure, because sometimes it's just not her day 😭

  • -EIO β€” I/O error, including metadata corruption πŸ’€ that's the messy one fr fr
  • -ENOENT β€” no block was found in the range, she looked and there was nothing there 🫠
  • -ENOMEM β€” insufficient memory available, the machine said "not today" 🧚

🌈 SEE ALSO 🌈

Kernel file ./fs/nilfs2/mdt.c β€” go read the source, iykyk πŸ“– and also these icons, all in the same friend group:


And that's the whole thing! 🌟 This absolute queen lives in ./fs/nilfs2, dated October 2026, and she's nilfs_mdt_find_block(9) from the Kernel API Manual β€” drink water, close your brackets, and go find some blocks bestie πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from