read_cache_folio(9)
π¦ 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β theaddress_spaceyou'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,NULLif you want it to useaops->read_folioinstead πfileβ this one gets passed to the filler function. it may beNULLif 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 π«Ά
filemap_remove_folio(9)filemap_fdatawrite_range(9)filemap_flush_range(9)filemap_flush(9)filemap_range_has_page(9)filemap_fdatawait_range(9)filemap_fdatawait_range_keep_errors(9)file_fdatawait_range(9)filemap_fdatawait_keep_errors(9)filemap_write_and_wait_range(9)file_check_and_advance_wb_err(9)file_write_and_wait_range(9)replace_page_cache_folio(9)softleaf_entry_wait_on_locked(9)folio_put_wait_locked(9)folio_unlock(9)folio_end_read(9)folio_end_private_2(9)folio_wait_private_2(9)folio_wait_private_2_killable(9)folio_end_writeback_no_dropbehind(9)folio_end_writeback(9)__folio_lock(9)page_cache_next_miss(9)page_cache_prev_miss(9)__filemap_get_folio_mpol(9)find_get_entries(9)find_lock_entries(9)filemap_get_folios(9)filemap_get_folios_contig(9)filemap_get_folios_tag(9)filemap_get_folios_dirty(9)filemap_read(9)generic_file_read_iter(9)filemap_splice_read(9)mapping_seek_hole_data(9)filemap_fault(9)mapping_read_folio_gfp(9)read_cache_page_gfp(9)__generic_file_write_iter(9)generic_file_write_iter(9)filemap_release_folio(9)filemap_invalidate_inode(9)filemap_cachestat(9)
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
- 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