nilfs_mdt_find_block(9)
π 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 offsetout_bhβ the place to store a pointer to thebuffer_headstruct, 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_bhandblkoffare substituted only when zero is returned. So like, don't go reading those outputs before a0, 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:
nilfs_mdt_get_block(9)nilfs_mdt_delete_block(9)nilfs_mdt_forget_block(9)nilfs_mdt_clear(9)nilfs_mdt_destroy(9)nilfs_mdt_setup_shadow_map(9)nilfs_mdt_save_to_shadow_map(9)nilfs_mdt_restore_from_shadow_map(9)nilfs_mdt_clear_shadow_map(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms