read_cache_folio(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ read_cache_folio(9) β€” Kernel API Manual ✨

okay so bestie, welcome to the read_cache_folio era of your life πŸ’… this is a kernel API page, we're in the Kernel API Manual, and this function is basically the "gimme that page, and if it's not there yet, build it for me" girlie πŸŽ€


🌸 NAME 🌸

read_cache_folio β€” read into page cache, and fill it if needed, no cap πŸ’–


✨ SYNOPSIS ✨

struct folio * read_cache_folio (struct address_space *mapping , pgoff_t
index , filler_t filler , struct file *file );

like yes she takes four args, don't panic, we're gonna go through every single one 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • mapping β€” the address_space you're reading from. that's the vibe source, iykyk πŸ“š
  • index β€” the index you wanna read. the exact spot, bestie, no guessing 🌸
  • filler β€” the function that actually performs the read. or, and this is important, NULL if you want it to use aops->read_folio instead πŸ™ˆ
  • file β€” this one gets passed to the filler function. it may be NULL if it's not required, so like... optional king πŸ‘‘

πŸ’– DESCRIPTION πŸ’–

so what she does is read one page into the page cache, that's the whole assignment πŸ”₯

if it succeeds, the folio returned will contain index β€” but ok listen, careful here: it may not be the first page of the folio πŸ‘€ like it's in there, but it's not necessarily the main character of that folio, vibe check accordingly.

and if the filler function returns an error, that error gets returned straight to the caller. not swallowed, not decorated, just handed right back to you 😭


🧚 CONTEXT 🧚

may sleep 😴 like genuinely, she's allowed to nap.

expects mapping->invalidate_lock to be held β€” so hold it, bestie, don't be out here forgetting the lock πŸ’€


πŸ‘‘ RETURN πŸ‘‘

an uptodate folio on success πŸ’– ERR_PTR on failure πŸ’€ that's it, that's the whole return situation, periodt.


🌈 SEE ALSO 🌈

the kernel file is ./mm/filemap.c and honestly there are so many siblings, let's list them all because we don't skip anybody in this house 🫢


and that's the whole page bestie, you ate πŸ’… this one's from ./mm, dated October 2026, and it's literally been a pleasure πŸ¦‹ mwah πŸ’–

πŸ“¦ where this page comes from