nilfs_mdt_get_block(9)
π nilfs_mdt_get_block(9) β from the Kernel API Manual, bestie β¨
okay so picture this: it's a kernel API manual page, the function is nilfs_mdt_get_block, and it lives in section 9 (that's the kernel-functions section, iykyk). she's a NILFS2 girlie and honestly? she ate. let's get into it π
πΈ NAME πΈ
nilfs_mdt_get_block β read or create a buffer on a meta data file, no cap π
β¨ SYNOPSIS β¨
int nilfs_mdt_get_block (struct inode *inode , unsigned long blkoff ,
int create , void (*init_block)(struct inode *, struct buffer_head *,
void *) , struct buffer_head **out_bh );
like, that's the whole signature, character for character, don't come for me π«Ά
π¦ ARGUMENTS π¦
inodeβ the inode of the meta data file. that's her main character energy right there πblkoffβ block offset. literally just which block we're talking about.createβ the create flag. non-zero means "yes bestie, make one if it's not there" β¨init_blockβ the initializer used for a newly allocated block. she does the formatting glow-up πout_bhβ output of a pointer to thebuffer_head. this is where the goods land π¦
π DESCRIPTION π
so nilfs_mdt_get_block looks up the specified buffer, and it tries to create a new buffer if create is not zero. periodt.
and listen β if (and only if) this function succeeds, it stores a pointer to the retrieved buffer head in the location pointed to by out_bh. if and only if, bestie, that's not a vibe, that's a contract π«‘
the retrieved buffer may be either an existing one or a newly allocated one β either way she's serving π
for a newly created buffer, if the callback function argument init_block is non-NULL, the callback will be called with the buffer locked to format the block. locked AND formatted, we love a responsible queen πβ¨
π₯ RETURN π₯
0 on success π β or one of these negative error codes on failure, and yeah they're all giving sad girl hours π:
-EIOβ I/O error (including metadata corruption). the metadata is not okay π-ENOENTβ the specified block does not exist (hole block). she's not there, she's on vacation π³οΈ-ENOMEMβ insufficient memory available. no thoughts, no RAM π-EROFSβ read only filesystem (for create mode). you cannot sit with us, it's read-only β
π§ SEE ALSO π§
Kernel file ./fs/nilfs2/mdt.c, plus the whole friend group:
nilfs_mdt_find_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)
the shadow map saga is real and honestly iconic ππ
ngl, if you're poking at a meta data file's buffers and you see -EIO staring back at you, check your metadata before you check your friends π
okay that's the whole page, slay, go read the source bestie π
this lil masterpiece comes to you from ./fs/nilfs2, dated October 2026, and it is β say it with me β nilfs_mdt_get_block(9) πβ¨π¦
π¦ 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