write_begin_get_folio(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 write_begin_get_folio(9) 🌸

okay so this is from the Kernel API Manual bestie, and we're talking about write_begin_get_folio β€” literally the little helper that gets you a folio for write_begin with all the right flags already set up πŸ’… no cap, it's giving "grab and go" energy.

✨ SYNOPSIS ✨

struct folio * write_begin_get_folio (const struct kiocb *iocb , struct
address_space *mapping , pgoff_t index , size_t len );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • iocb β€” the kiocb that got passed down from write_begin. it may be NULL and that's totally fine, no biggie ✨
  • mapping β€” the address space we're searching through. this is where we're looking, periodt πŸ”
  • index β€” the page cache index. iykyk πŸ“–
  • len β€” length of the data being written. the amount, the size, the vibe check on how much we're dealing with πŸ’–

πŸ’« DESCRIPTION πŸ’«

this is a helper for filesystem write_begin implementations β€” main character energy for the write_begin girlies πŸ‘‘

basically it wraps __filemap_get_folio and sets the appropriate flags in the write begin context. that's it, that's the whole job. lowkey iconic for doing exactly one thing and doing it well 🫢

πŸ”₯ RETURN πŸ”₯

you get back a folio β€” or an ERR_PTR. so like, check it before you use it, bestie 😭 don't just assume it's valid.

🌈 SEE ALSO 🌈

this list is long but we don't skip, we don't summarize, we include every single one because that's the assignment πŸ’€

Kernel file ./include/linux/pagemap.h

then all 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), 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), folio_mkwrite_check_truncate(9), i_blocks_per_folio(9)

like I said. every. single. one. πŸŽ€


and that's the page bestie!! this one lives over in ./include/linux, came out of the Kernel API Manual, and it's dated October 2026 β€” see you in the next group chat πŸ’œβœ¨

πŸ“¦ where this page comes from