fgf_t(9)
π
fgf_t(9) β the kernel API glow-up
okay so bestie, welcome to the fgf_t page from the Kernel API Manual β¨ this one is literally just a typedef, and honestly? she's an icon. let's get into it π
πΈ NAME
typedef fgf_t β Flags for getting folios from the page cache. that's it, that's the whole vibe π
β¨ Description
okay so first thing, real talk: most users of the page cache will not need to use these flags π«Ά there are convenience functions for that, like filemap_get_folio and filemap_lock_folio β those are your besties, they do the thing for you, no cap.
but if you're the kind of person who needs more control over exactly what gets done with the folios (main character energy, honestly), then these flags to __filemap_get_folio are available to you. slay. π
π¦ the flags themselves
FGP_ACCESSEDβ the folio will be marked accessed. noted. tracked. perceived. β¨FGP_LOCKβ the folio is returned locked. πFGP_CREATβ if no folio is present, a brand new folio gets allocated, added to the page cache and to the VM's LRU list. and yeah, the folio is returned locked. new folio, who dis πFGP_FOR_MMAPβ the caller wants to do its own locking dance if the folio is already in cache πΊ and if the folio was allocated, it gets unlocked before returning so the caller can do the same dance. everybody's dancing, it's fine.FGP_WRITEβ the folio will be written to by the caller. go off, write your little bytes βοΈFGP_NOFSβ__GFP_FSwill get cleared ingfp. that's the whole thing, no notes.FGP_NOWAITβ don't block on the folio lock. we are not waiting, bestie, we have places to be πββοΈπ¨FGP_STABLEβ wait for the folio to be stable (finished writeback). patient queen behavior πΈFGP_DONTCACHEβ uncached buffered IO. that's it. that's the bullet πFGP_WRITEBEGINβ the flags to use in a filesystemwrite_beginimplementation. this is the combo meal π
π SEE ALSO
okay so this list is long long, but every single one of these is a real one, so here we go β kernel file ./include/linux/pagemap.h, plus:
filemap_set_wb_err(9), filemap_check_wb_err(9), filemap_sample_wb_err(9), file_sample_sb_err(9), mapping_set_error(9), mapping_set_large_folios(9), mapping_align_index(9), mapping_pmd_folio_support(9), folio_flush_mapping(9), folio_inode(9), folio_attach_private(9), folio_change_private(9), folio_detach_private(9), fgf_set_order(9), write_begin_get_folio(9), filemap_get_folio(9), filemap_lock_folio(9), filemap_grab_folio(9), find_get_page(9), find_lock_page(9), find_or_create_page(9), grab_cache_page_nowait(9), folio_next_index(9), folio_next_pos(9), folio_file_page(9), folio_contains(9), page_pgoff(9), folio_pos(9), linear_page_delta(9), linear_page_index(9), linear_anon_page_index(9), folio_trylock(9), folio_lock(9), lock_page(9), folio_lock_killable(9), filemap_range_needs_writeback(9), struct readahead_control(9), page_cache_sync_readahead(9), page_cache_async_readahead(9), readahead_folio(9), readahead_pos(9), readahead_length(9), readahead_index(9), readahead_count(9), readahead_batch_length(9), folio_mkwrite_check_truncate(9), i_blocks_per_folio(9)
like, that's a whole friend group right there π
ngl, if you read this whole page and still don't know which flag you want, maybe start with the convenience functions. just saying π«Ά
okay that's the page!! it lives in ./include/linux, dated October 2026, and it's part of the Kernel API Manual β fgf_t(9), iconic, no notes, periodt π
β¨π
π¦ 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