write_inode_now(9)
πΎ write_inode_now β the Kernel API Manual, bestie edition πΎ
okay so you found the write_inode_now(9) page in the Kernel API Manual, and honestly? it's a little baddie with one job. let's get into it π
β¨ NAME β¨
write_inode_now β write an inode to disk. that's it. that's the whole glow-up. π
π¦ SYNOPSIS π¦
int write_inode_now (struct inode *inode , int sync );
look at her. two params, no drama. π
πΈ ARGUMENTS πΈ
inodeβ the inode we're writing to disk. the main character of this whole operation, no cap. πsyncβ a lil flag telling us whether the write should be synchronous or not. lowkey the vibe check for how patient we're being. β³
π DESCRIPTION π
so here's the tea: this function commits an inode to disk immediately if it is dirty. like, not "whenever the kernel gets around to it" β right now. it's giving "we are not waiting." π₯
who's this for? primarily it's needed by knfsd. that's the whole reason she exists, fr fr. π§
β οΈ important caveat, bestie, do not skip this one: the caller must either have a ref on the inode or must have set I_WILL_FREE. that's not optional, that's the rule. π
π SEE ALSO π
the whole friend group, gathered here in Kernel file ./fs/fs-writeback.c:
inode_io_list_move_locked(9)wb_wait_for_completion(9)inode_cgwb_move_to_attached(9)locked_inode_to_wb_and_lock_list(9)inode_to_wb_and_lock_list(9)inode_switch_wbs(9)cleanup_offline_cgwb(9)wbc_attach_and_unlock_inode(9)wbc_attach_fdatawrite_inode(9)wbc_detach_inode(9)wbc_account_cgroup_owner(9)wb_split_bdi_pages(9)bdi_split_work_to_wbs(9)cgroup_writeback_by_id(9)cgroup_writeback_umount(9)wb_start_background_writeback(9)filemap_dontcache_kick_writeback(9)__mark_inode_dirty(9)writeback_inodes_sb_nr(9)writeback_inodes_sb(9)try_to_writeback_inodes_sb(9)sync_inodes_sb(9)sync_inode_metadata(9)
like, the entire writeback friend group showed up to the group chat. iconic behavior honestly. π«Ά
and that's the page!! this lil drop came out of ./fs in October 2026 β so when you cite her, you know exactly where she lives and when she was posted. stay hydrated, keep your inodes clean, and don't forget your ref or your I_WILL_FREE. mwah πβπ
π¦ 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