filemap_ran...ds_writeback(9)
β¨ NAME β¨
ok so this whole page is about filemap_range_needs_writeback β and yes bestie, the header is literally truncated as filemap_ran...ds_writeback(9) because some things are just too iconic to fit π
. It lives in section 9 of the Kernel API Manual, and what it does is check if a range potentially needs writeback. that's the whole vibe check right there.
π«Ά SYNOPSIS π«Ά
bool filemap_range_needs_writeback (struct address_space *mapping ,
loff_t start_byte , loff_t end_byte );
look at her go π returns a bool, takes three args, no notes.
π ARGUMENTS π
mappingβ the address space you're checking inside of. like, the neighborhood you're snooping around in ποΈstart_byteβ the offset in bytes where the range startsend_byteβ the offset in bytes where the range ends, and it's inclusive, so the end byte is part of the party too, no cap π
π₯ DESCRIPTION π₯
So the whole point: this finds at least one page in the range you handed it. Usually it's used to check whether direct writing inside that range is gonna trigger a writeback β like a little "hey bestie, is this about to get messy?" heads-up πΈ.
It's used by O_DIRECT read/write with IOCB_NOWAIT, to see if the caller needs to do filemap_write_and_wait_range before proceeding. so it's literally the "do I have to do the boring wait thing first?" detector π§
β RETURN β
trueβ yes babes, the caller should dofilemap_write_and_wait_rangebefore doingO_DIRECTto a page in this range πfalseβ nope, you're free, go do yourO_DIRECTthing π¦
π SEE ALSO π
the whole friend group showed up for this one, we love to see it π
Kernel file ./include/linux/pagemap.h
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)folio_contains(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)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)
ok that's the whole page, you ate that π
β¨ and for the sign-off credits moment: this lil masterpiece is sourced from ./include/linux, dated October 2026, and it's filed under filemap_ran...ds_writeback(9) in the Kernel API Manual. 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