filemap_get_folios(9)
π
filemap_get_folios β from the Kernel API Manual, bestie β¨
okay so this one lives in the Kernel API Manual (filemap_get_folios(9)), and it's literally the "gimme a whole batch of folios at once" function. no cap, she's a workhorse π«Ά
β¨ NAME β¨
filemap_get_folios β get a batch of folios π
πΈ SYNOPSIS πΈ
unsigned filemap_get_folios (struct address_space *mapping , pgoff_t
*start , pgoff_t end , struct folio_batch *fbatch );
like, that's the whole signature. she takes four things and gives you back an unsigned. iconic π
π¦ ARGUMENTS π¦
mappingβ theaddress_spaceyou're searching through. this is the place you're digging in πstartβ the starting page index. where the hunt begins β¨endβ the final page index, and yes bestie it's inclusive (the end counts too, don't forget her) π«Άfbatchβ the batch you're filling up. she's the basket, the folios are the strawberries π
π DESCRIPTION π
so what she does is: search for and return a batch of folios in the mapping, starting at index start and going up to index end (inclusive). and the folios come back to you in fbatch with an elevated reference count β like, they've been bumped up, they're important now, don't just drop them π
that's the whole vibe check. search, batch, elevate, done π
β RETURN β
she returns the number of folios which were found. and the extra cute part: start also gets updated so it indexes the next folio for the traversal β so you can just keep going, iykyk π₯
π SEE ALSO π
okay this list is long long, but we don't skip anybody here. the kernel file ./mm/filemap.c is where the magic lives, and here's everyone else in the family:
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_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)read_cache_folio(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)
like I said. everyone. π
ngl bestie, remember that elevated reference count β that's the one thing people fumble. you got this though π§
and that's a wrap, mwah π β this one's from the ./mm source, October 2026 edition, filed under filemap_get_folios(9). periodt. π
π¦ 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