mapping_seek_hole_data(9)
π NAME π
okay so this is the Kernel API Manual entry for mapping_seek_hole_data(9), and it is lowkey iconic. π
mapping_seek_hole_dataβ seek forSEEK_DATA/SEEK_HOLEin the page cache. bestie, that's the whole vibe. β¨
πΈ SYNOPSIS πΈ
the signature is giving main character energy, fr fr:
loff_t mapping_seek_hole_data (struct address_space *mapping , loff_t
start , loff_t end , int whence );
π¦ ARGUMENTS π¦
mappingβ the address space to search. that's the zone you're snooping around in. πstartβ first byte to consider. the starting line, no cap.endβ limit of search, and yes it's exclusive. do not forget, bestie. πwhenceβ eitherSEEK_HOLEorSEEK_DATA. pick your fighter. βοΈ
π DESCRIPTION π
so if the page cache knows which blocks contain holes and which blocks contain data, your filesystem can use this function to implement SEEK_HOLE and SEEK_DATA. that's the whole point, and it ate. π₯
this is useful for filesystems that are entirely memory-based β such as tmpfs β and for filesystems that support unwritten extents. yep, both of those girlies get to use it. π«Ά
β RETURN β
on success you get the requested offset back. slay. β¨
but if whence specifies SEEK_DATA and there is no data after start, you get -ENXIO. that's the "no data here, bestie" signal. π
also, there is an implicit hole after end - 1, so SEEK_HOLE returns end if all the bytes between start and end contain data. literally important, don't skip it. π
π SEE ALSO π
Kernel file ./mm/filemap.c is the homebase, and the whole SEE ALSO crew is right here β go say hi:
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_tag(9)filemap_get_folios_dirty(9)filemap_read(9)generic_file_read_iter(9)filemap_splice_read(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 page, bestie β source/version ./mm, dated October 2026, and yes she ate. mwah ππ
π¦ 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