fgf_t(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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_FS will get cleared in gfp. 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 filesystem write_begin implementation. 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