filemap_get_folios(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… filemap_get_folios β€” from the Kernel API Manual, bestie ✨

okay so this one lives in the Kernel API Manual (filemap_get_folios(9)), and it's literally the "gimme a whole batch of folios at once" function. no cap, she's a workhorse 🫢


✨ NAME ✨

filemap_get_folios β€” get a batch of folios πŸŽ€


🌸 SYNOPSIS 🌸

unsigned filemap_get_folios (struct address_space *mapping , pgoff_t
*start , pgoff_t end , struct folio_batch *fbatch );

like, that's the whole signature. she takes four things and gives you back an unsigned. iconic πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • mapping β€” the address_space you're searching through. this is the place you're digging in πŸ”
  • start β€” the starting page index. where the hunt begins ✨
  • end β€” the final page index, and yes bestie it's inclusive (the end counts too, don't forget her) 🫢
  • fbatch β€” the batch you're filling up. she's the basket, the folios are the strawberries πŸ“

πŸ’– DESCRIPTION πŸ’–

so what she does is: search for and return a batch of folios in the mapping, starting at index start and going up to index end (inclusive). and the folios come back to you in fbatch with an elevated reference count β€” like, they've been bumped up, they're important now, don't just drop them πŸ™ˆ

that's the whole vibe check. search, batch, elevate, done πŸ‘‘


⭐ RETURN ⭐

she returns the number of folios which were found. and the extra cute part: start also gets updated so it indexes the next folio for the traversal β€” so you can just keep going, iykyk πŸ”₯


🌈 SEE ALSO 🌈

okay this list is long long, but we don't skip anybody here. the kernel file ./mm/filemap.c is where the magic lives, and here's everyone else in the family:

like I said. everyone. πŸ’€


ngl bestie, remember that elevated reference count β€” that's the one thing people fumble. you got this though 🧚

and that's a wrap, mwah πŸ’œ β€” this one's from the ./mm source, October 2026 edition, filed under filemap_get_folios(9). periodt. πŸ‘‘

πŸ“¦ where this page comes from