filemap_get_folios_tag(9)
π filemap_get_folios_tag(9) π
Okay bestie, welcome to the Kernel API Manual β¨ β today's main character is filemap_get_folios_tag, and honestly? She's giving "batch fetch but make it tagged." Let's get into it π«Ά
πΈ NAME πΈ
filemap_get_folios_tag β get a batch of folios matching @tag π
β¨ SYNOPSIS β¨
unsigned filemap_get_folios_tag (struct address_space *mapping , pgoff_t
*start , pgoff_t end , xa_mark_t tag , struct folio_batch *fbatch );
π ARGUMENTS π
mappingβ theaddress_spaceyou're searching, aka the vibe-check zone π«startβ the starting page index, where the hunt begins πendβ the final page index, and yes bestie it's inclusive π«Άtagβ the tag index, the filter of it all πfbatchβ the batch to fill, the little bucket she fills up π§Ί
π¦ DESCRIPTION π¦
So here's the tea β: the first folio may start before start β and if it does, it'll contain start. The final folio may extend beyond end, and if it does, it'll contain end. Lowkey flexible like that πββοΈ
The folios have ascending indices β all lined up in order, slay β¨
There may be gaps between the folios if there are indices which have no folio in the page cache β so don't be shocked by a missing spot, it's just how it is π
Ngl this part matters: if folios are added to or removed from the page cache while this is running, they may or may not be found by this call. No cap, concurrent changes are not guaranteed to show up. π
Only returns folios that are tagged with tag β she's selective, periodt π
π₯ RETURN π₯
The number of folios found π Also, it updates start to index the next folio for traversal β so you can keep it moving, iykyk π
π SEE ALSO π
Kernel file ./mm/filemap.c and honestly the whole friend group:
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_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)
That's the whole page bestie π β brought to you by ./mm, the October 2026 edition of filemap_get_folios_tag(9). Go forth and batch those tagged folios, you icon ππ¦
π¦ 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