mapping_read_folio_gfp(9)
β¨ mapping_read_folio_gfp(9) β¨
okay so bestie, welcome to the glow-up of mapping_read_folio_gfp(9) π
this is a kernel API manual page and we're about to make it make sense, no cap. it's giving "page cache realness" and honestly? we're obsessed.
πΈ NAME πΈ
mapping_read_folio_gfp β read into the page cache, but like... using the allocation flags you specify. periodt. π
π SYNOPSIS π
struct folio * mapping_read_folio_gfp (struct address_space *mapping ,
pgoff_t index , gfp_t gfp );
literally the whole signature, bestie. copy it exactly, don't @ me.
π¦ ARGUMENTS π¦
mappingβ theaddress_spacefor the folio. iykyk, it's the home base. πindexβ the index that the allocated folio will contain. like, the assigned seat number bestie. π«gfpβ the page allocator flags to use if allocating. these are the vibes you're setting for memory allocation, fr fr. βοΈ
π DESCRIPTION π
okay so here's the tea: this function is literally the same as:
read_cache_folio(mapping, index, NULL, NULL)
...but with any new memory allocations done using the specified allocation flags. that's it, that's the whole difference. iconic behavior, honestly. π
now for the messy parts β the most likely error from this function is EIO, but ENOMEM is possible and so is EINTR. like, it could be any of those three, bestie, so don't come for me if your error handling is sloppy. π and if ->read_folio returns another error, that will be returned to the caller. so whatever ->read_folio says, goes. no cap. π₯
the function expects mapping->invalidate_lock to be already held. yes, you read that right β it's a prerequisite. please hold the lock before calling this, or it's giving "crash era" and we don't want that. π
bestie warning: mapping->invalidate_lock must already be held when you call this. don't skip this step, i'm literally begging you π
β RETURN β
uptodate folio on success. ERR_PTR on failure. that's the whole return section, short and slay. β¨
π SEE ALSO π
okay this list is long but we don't gatekeep! here's every single reference, bestie. all of them. i'm not skipping a single one, because that's not the vibe. π
- 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)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)mapping_seek_hole_data(9)filemap_fault(9)read_cache_folio(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)
and that's the whole page bestie! brought to you by the ./mm girlies, dropping October 2026. stay slay, keep your locks held, and remember: uptodate folio on success, ERR_PTR on failure. 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