filemap_get_folio(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… filemap_get_folio β€” the Kernel API Manual, bestie edition ✨

okay so this is filemap_get_folio(9) from the Kernel API Manual, and honestly? it's giving "small function, huge main character energy" πŸŽ€ let's get into it.


🌸 NAME 🌸

filemap_get_folio β€” find and get a folio. that's it. that's the whole vibe. πŸ’–


✨ SYNOPSIS ✨

struct folio * filemap_get_folio (struct address_space *mapping ,
pgoff_t index );

literally two args, no cap. 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • mapping β€” the address_space you're searching through. this is the lookup zone, the search space, the place where the folios live. πŸ”
  • index β€” the page index. yeah. the index. of the page. that one. πŸ“–

πŸ’œ DESCRIPTION πŸ’œ

so what it does β€” it looks up the page cache entry at mapping & index. cute, right? and if a folio is actually present there? it gets returned to you with an increased refcount πŸ‘‘ so like, bestie, you now own a reference. hold onto it responsibly. that's the whole thing. πŸ’…


πŸ”₯ RETURN πŸ”₯

you get either:

  • a folio πŸ’– β€” slay, it was there
  • or ERR_PTR(-ENOENT) 😭 β€” if there's no folio in the cache for this index

and important: it will not return a shadow, swap or DAX entry. periodt. not doing it. don't ask. πŸ’€


🌈 SEE ALSO 🌈

Kernel file ./include/linux/pagemap.h, plus this absolutely iconic lineup of related pages (iykyk):

like, that's a whole friend group right there πŸ§šπŸ’œ


🫢 quick reminder bestie: the refcount is increased when a folio comes back to you. that's the deal. don't fumble it.

and that's the page!! sourced from ./include/linux, dated October 2026, filed under filemap_get_folio(9) β€” mwah, go read some folios πŸ’‹πŸŒΈβ­

πŸ“¦ where this page comes from