folio_mkwrit...eck_truncate(9)
π folio_mkwrite_check_truncate(9) β from the Kernel API Manual, bestie β¨
Okay so picture this: you're in the kernel, you've got a folio, you've got an inode, and you just need to know if that folio got truncated out from under you. That's the whole gig. Welcome to the group chat π«Ά
πΈ NAME πΈ
folio_mkwrite_check_truncate β literally just checks if the folio was truncated. That's it. That's the function. π
β¨ SYNOPSIS β¨
ssize_t folio_mkwrite_check_truncate (const struct folio *folio , const
struct inode *inode );
Look at her. Gorgeous. Returns a ssize_t, takes two const pointers because she does not modify your stuff, she's a respectful queen π. Also yes, the signature is wrapped across two lines in the original and we're keeping it exactly like that, no cap.
π ARGUMENTS π
folioβ the folio to check. The main character of this whole operation. πinodeβ the inode to check the folio against. The vibe reference. The thing we're comparing against. π¦
π RETURN π
So here's what you get back:
- the number of bytes in the folio up to EOF β the happy path, the slay path π
- or
-EFAULTif the folio was truncated β the sad path, the "why is this happening to me" path π
That's it. Two outcomes. No in-between. Periodt.
π₯ SEE ALSO π₯
Buckle up bestie, this list is long β but every single one deserves her moment. Kernel file ./include/linux/pagemap.h is the home base for all of these:
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)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)i_blocks_per_folio(9)
Forty-six entries. Forty-six!! Not me counting them all. Anyway, they're all right there in ./include/linux/pagemap.h, go read them, iykyk ππ
Heads up bestie β the -EFAULT return is a real thing you have to handle. The folio got truncated. Don't just vibe past it. π
β¨ that's the whole page, mwah β¨ This one lives at ./include/linux, dated October 2026, and the page title is folio_mkwrit...eck_truncate(9) (yes the header truncates the name, iconic of it honestly). Later, bestie! π
ππ¦
π¦ 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