find_lock_entries(9)
β¨ find_lock_entries π
hey bestie, welcome to the find_lock_entries(9) page from the Kernel API Manual β like, the kernel internals manual, and yes we're being cute about it π
πΈ NAME πΈ
find_lock_entries β bestie, it finds a batch of pagecache entries. that's it. that's the vibe. π¦
β¨ SYNOPSIS β¨
unsigned find_lock_entries (struct address_space *mapping , pgoff_t
*start , pgoff_t end , struct folio_batch *fbatch , pgoff_t *indices );
like, look at her. iconic signature. no cap. π
π ARGUMENTS π
mappingβ theaddress_spacewe're searching through, okurrr π«startβ the starting page cache index, the beginning of the whole thing πΈendβ the final page index, and yes it's inclusive, don't forget that part π«Άfbatchβ where the resulting entries get placed, her little home πindicesβ the cache indices of the entries chilling infbatchβ¨
π¦ DESCRIPTION π¦
okay so find_lock_entries will return a batch of entries from mapping. and listen β swap, shadow and DAX entries are included. all of them, invited to the party π₯
folios come back locked and with an incremented refcount, so stay on top of that, bestie, fr fr π
folios that are locked by somebody else? skipped. folios under writeback? also skipped. folios that are partially outside the range? not returned, nope, not today π
the entries have ascending indexes β β but here's the thing, the indices may not be consecutive, and it's giving very much "it's complicated" π. why? because of not-present entries, large folios, folios which could not be locked, or folios under writeback. so many reasons. she's a mystery. π§
π RETURN π
the number of entries which were found π β that's the return value, simple as that.
π SEE ALSO π
okay this list is literally a whole squad, buckle up bestie:
- kernel file
./mm/filemap.c 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)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)
π reminder bestie: no inventing behaviour, everything above is straight from the page β if find_lock_entries skips your folio it's because it's locked by someone else, under writeback, or partially out of range. not personal. probably. π
and that's the page!! π«Ά sign-off time: this beauty comes from ./mm, dated October 2026, and it's find_lock_entries(9) β slay, 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