filemap_invalidate_inode(9)
π filemap_invalidate_inode(9) π
okay bestie, today's main character is filemap_invalidate_inode(9) and she is literally the girl who clears out an inode's pagecache range β either by gently yeeting the folios or by making them write back first. no cap. β¨
πΈ NAME πΈ
filemap_invalidate_inode β invalidate / forcibly write back a range of an inode's pagecache
like, she shows up, she decides what stays and what goes, and she can make it flush on the way out. it's giving eviction notice with a bow on it π
β SYNOPSIS β
int filemap_invalidate_inode (struct inode *inode , bool flush , loff_t start , loff_t end );
one function, four args, zero drama (she handles the drama internally, tyvm) π
π¦ ARGUMENTS π¦
inodeβ the inode you're flushing. that's your girl, that's the target πflushβ set this to write back rather than simply invalidate. so like, do you want them saved before they leave, or just gone? your call, bestie π«Άstartβ first byte in range. the beginning of the story β¨endβ last byte in range (inclusive), orLLONG_MAXfor everything fromstartonwards.LLONG_MAXis the "idk just take everything" option and honestly? relatable π
π₯ DESCRIPTION π₯
so what she does is: invalidate all the folios on an inode that contribute to the specified range β possibly writing them back first, if you set flush. like, she'll pack their bags for them if you ask nicely π§³
and the important bit, ngl: whilst the operation is undertaken, the invalidate lock is held to prevent new folios from being installed. so nobody's sneaking new folios into the range while she's mid-cleanup. no gatecrashing. periodt π
π real talk: that lock is held for the whole operation, so don't go thinking new folios can slip in. they can't. the door is shut, the vibes are locked down, we're safe.
π SEE ALSO π
Kernel file ./mm/filemap.c β and honestly the whole folio friend group, they all showed up:
filemap_remove_folio(9)filemap_fdatawrite_range(9)filemap_flush_range(9)filemap_flush(9)filemap_range_has_page(9)filemap_fdatawait_range(9)filemap_fdatawait_range_keep_errors(9)file_fdatawait_range(9)filemap_fdatawait_keep_errors(9)filemap_write_and_wait_range(9)file_check_and_advance_wb_err(9)file_write_and_wait_range(9)replace_page_cache_folio(9)softleaf_entry_wait_on_locked(9)folio_put_wait_locked(9)folio_unlock(9)folio_end_read(9)folio_end_private_2(9)folio_wait_private_2(9)folio_wait_private_2_killable(9)folio_end_writeback_no_dropbehind(9)folio_end_writeback(9)__folio_lock(9)page_cache_next_miss(9)page_cache_prev_miss(9)__filemap_get_folio_mpol(9)find_get_entries(9)find_lock_entries(9)filemap_get_folios(9)filemap_get_folios_contig(9)filemap_get_folios_tag(9)filemap_get_folios_dirty(9)filemap_read(9)generic_file_read_iter(9)filemap_splice_read(9)mapping_seek_hole_data(9)filemap_fault(9)read_cache_folio(9)mapping_read_folio_gfp(9)read_cache_page_gfp(9)__generic_file_write_iter(9)generic_file_write_iter(9)filemap_release_folio(9)filemap_cachestat(9)
and that's the whole page, bestie!! this one came to you straight out of the ./mm source, dated October 2026 β so mark your calendar, she's a Scorpio or whatever π¦β¨ mwah, go invalidate something responsibly ππ
π¦ 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