folio_contains(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– folio_contains β€” a Gen Z field guide πŸ’–

okay so bestie, welcome to folio_contains, straight out of the Kernel API Manual ✨ this one is tiny but she is mighty β€” the whole entire job is answering one (1) question: does this folio contain this index? that's it. that's the function. and honestly? she ate. πŸŽ€


🌸 NAME 🌸

folio_contains β€” Does this folio contain this index? πŸ’…


✨ SYNOPSIS ✨

bool folio_contains (const struct folio *folio , pgoff_t index );

look at her. two arguments. a bool return. no drama, no notes, no cap. πŸ¦‹


🫢 ARGUMENTS 🫢

  • folio β€” the folio. yes that's it, that's the whole description. she's the main character of this call, okay, show some respect πŸ‘‘
  • index β€” the page index within the file. 🌈

πŸ”₯ CONTEXT πŸ”₯

okay so this part is the vibe check and you need to pass it ngl:

  • the caller should have the folio locked πŸ”’
  • and also make sure e.g. shmem did not move this folio to the swap cache πŸŒ€
like, do those two things first or the whole thing is giving chaos energy 😭 don't skip this, bestie.

⭐ RETURN ⭐

true or false. ✨ that's the whole answer. binary queen, periodt. πŸ’€


🐚 SEE ALSO 🐚

the kernel file ./include/linux/pagemap.h and honestly a whole extended friend group πŸ’œ β€” go say hi to all of them:

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), folio_flush_mapping(9), folio_inode(9), folio_attach_private(9), folio_change_private(9), folio_detach_private(9), fgf_t(9), fgf_set_order(9), 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), folio_next_index(9), folio_next_pos(9), folio_file_page(9), page_pgoff(9), folio_pos(9), linear_page_delta(9), linear_page_index(9), linear_anon_page_index(9), folio_trylock(9), folio_lock(9), lock_page(9), folio_lock_killable(9), filemap_range_needs_writeback(9), struct readahead_control(9), page_cache_sync_readahead(9), page_cache_async_readahead(9), readahead_folio(9), readahead_pos(9), readahead_length(9), readahead_index(9), readahead_count(9), readahead_batch_length(9), folio_mkwrite_check_truncate(9), i_blocks_per_folio(9)


okay that's the whole page, ily, go forth and check your indexes responsibly πŸ§šπŸ’–

sign-off time: this lil icon lives in ./include/linux πŸ“, and the date on her birth certificate says October 2026 ⭐ see you in the group chat πŸ’…

πŸ“¦ where this page comes from