mapping_read_folio_gfp(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 β€” the address_space for 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. πŸ’…


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