filemap_dirty_folio(9)
π filemap_dirty_folio(9)
okay bestie, welcome to the Kernel API Manual β today's main character is filemap_dirty_folio, and honestly? she's kind of a big deal π
β¨ NAME β¨
filemap_dirty_folio β mark a folio dirty for filesystems that don't use buffer_heads, no cap π
πΈ SYNOPSIS πΈ
bool filemap_dirty_folio (struct address_space *mapping , struct folio
*folio );
like, literally that's the whole signature, copy it exactly pls π«Ά
π¦ ARGUMENTS π¦
mappingβ the address space this folio belongs to. it's her home, her address space, her territory πfolioβ the folio that's getting marked as dirty. yes, that kind of dirty, it's a filesystem thing π
β DESCRIPTION β
so here's the tea β β filesystems that do not use buffer heads should call this function from their dirty_folio address space operation. that's it, that's the assignment, slay.
it ignores the contents of folio_get_private, which is lowkey important: if your filesystem marks individual blocks as dirty, then your filesystem has to handle that itself. nobody's gonna do it for you, bestie β that's your own lore π§
this is also sometimes used by filesystems that do use buffer_heads, specifically when a single buffer is being dirtied: we want to set the folio dirty in that case, but not all the buffers. and the vibes here are very specific β this is a "bottom-up" dirtying, whereas block_dirty_folio is a "top-down" dirtying. two different energies, iykyk π
β οΈ the caller must ensure this doesn't race with truncation. most will simply hold the folio lock, but e.g. zap_pte_range calls with the folio mapped and the pte lock held, which also locks out truncation. no racing, periodt. π¨
π₯ SEE ALSO π₯
kernel file ./mm/page-writeback.c and the whole friend group:
node_dirtyable_memory(9)global_dirtyable_memory(9)domain_dirty_limits(9)global_dirty_limits(9)node_dirty_limit(9)node_dirty_ok(9)__wb_calc_thresh(9)balance_dirty_pages_ratelimited_flags(9)balance_dirty_pages_ratelimited(9)wb_over_bg_thresh(9)tag_pages_for_writeback(9)writeback_iter(9)folio_redirty_for_writepage(9)folio_mark_dirty(9)folio_wait_writeback(9)folio_wait_writeback_killable(9)folio_wait_stable(9)
and that's the page, bestie π it lives in ./mm, it's dated October 2026, and it goes by filemap_dirty_folio(9) β mwah, go mark some folios dirty 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