filemap_range_has_page(9)
π filemap_range_has_page β like, the whole vibe of this page
okay so real talk, this one lives in the Kernel API Manual, and it's genuinely one of the more chill functions you'll meet. no cap. let's get into it π«Ά
β¨ NAME β¨
filemap_range_has_page β bestie, it checks if a page exists in a range. that's it, that's the whole job π
πΈ SYNOPSIS πΈ
bool filemap_range_has_page (struct address_space *mapping , loff_t
start_byte , loff_t end_byte );
look at her. three args, returns a bool. she's an icon, she's a legend, and she is the moment π
π¦ ARGUMENTS π¦
mappingβ the address space you're poking around in. this is the "where am i even looking" arg, and it's astruct address_space *so yeah, pointer brain on πstart_byteβ offset in bytes where the range starts. like, where the little search party begins πend_byteβ offset in bytes where the range ends, and listen: it's inclusive. meaning theend_byteposition is in the range. do not come for her boundaries, she's very clear about them β¨
π§ DESCRIPTION π§
so the whole point: she goes and finds at least one page in the range you supplied. that's the mission. that's the entire mission π
and where does this actually get used? usually to check if direct writing in this range will trigger a writeback. so like, "hey bestie, if i write here, is that gonna kick off a writeback?" β that's the vibe check this function performs π₯
not me being obsessed with a range-checking function. but here we are. main character energy fr fr π
π RETURN π
trueβ yay! at least one page exists in the specified range πfalseβ no page in there. empty. ghost town. periodt π
she literally returns a bool, so no sneaky extra values, no surprises, we love a consistent queen π
β SEE ALSO β
okay this list is long long, so buckle up bestie, we're going through all of it. no skipping, no summarising, i would never π
first, the source of all this lore lives in the kernel file ./mm/filemap.c, which is basically the group chat where all these functions hang out:
filemap_remove_folio(9)filemap_fdatawrite_range(9)filemap_flush_range(9)filemap_flush(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)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. long long. go read them all, i believe in you π«Άβ¨
reminder bestie: end_byte is inclusive. i know i said it already but i will say it again because someone always forgets π
and that's the page!! this one's from ./mm, and the version/date on the tin is October 2026 β so mark your calendars, screenshot it, send it to the group chat ππ¦ bye bestie, go check those ranges π
π¦ 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