page_cache_sync_readahead(9)
π page_cache_sync_readahead(9) β hey bestie, welcome to the Kernel API Manual π
okay so. this one is lowkey short but it's important, so pay attention bestie β¨
πΈ NAME πΈ
page_cache_sync_readahead β generic file readahead. that's it, that's the whole name. iconic brevity fr fr.
π¦ SYNOPSIS π¦
void page_cache_sync_readahead (struct address_space *mapping , struct
file_ra_state *ra , struct file *file , pgoff_t index , unsigned long
req_count );
like, look at those args. five of them. all lined up. main character energy honestly π
π ARGUMENTS π
mappingβ theaddress_spacethat holds the pagecache and the I/O vectors. it's the whole vibe of the file's cached pages, okay?raβ thefile_ra_state, which is literally where the readahead state lives. this is the memory of "what has this file been doing lately" π§fileβ used by the filesystem for authentication. yes, really, that's what the docs say, that's the whole job.indexβ the index of the first page to be read. your starting point, your origin story πreq_countβ the total number of pages the caller is reading. so like, how much they ordered off the menu π
π DESCRIPTION π
okay so this is the thing you call when a cache miss just happened π like you went looking for a page and it was NOT there, tragic, and now you need the actual read submitted.
page_cache_sync_readahead does that submit for you. that's the move. that's the whole assignment β¨
and here's the cute part β the readahead logic may decide to piggyback more pages onto your read request if the access patterns suggest it'll improve performance. like it saw you reading and went "oh we're doing this? bet, let me grab the neighbors too" π no cap, it's just reading the room and being generous.
bestie note: this is the sync one. there's an async sibling chilling in the SEE ALSO list below, so don't get it twisted π
π«Ά SEE ALSO π«Ά
kernel file ./include/linux/pagemap.h, and literally everyone from the function group chat:
the wb_err / mapping crew π
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)
the folio private-data babes π
folio_flush_mapping(9),folio_inode(9)folio_attach_private(9),folio_change_private(9),folio_detach_private(9)
the fgf situation π¦
the "get me a folio/page" girlies π
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)
the index/position icons π§
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)
the locking besties π₯
misc slay β
filemap_range_needs_writeback(9)struct readahead_control(9)
the readahead family β your actual relatives π
page_cache_async_readahead(9)readahead_folio(9),readahead_pos(9),readahead_length(9),readahead_index(9),readahead_count(9),readahead_batch_length(9)
the stragglers, still valid, still loved π
okay that's the whole page bestie, you ate that π stay hydrated, go read some pages ahead of time, and remember: ./include/linux, October 2026, straight from the Kernel API Manual β 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