truncate_inode_pages(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… truncate_inode_pages β€” the Kernel API Manual page, bestie ✨

okay so this is truncate_inode_pages(9) from the Kernel API Manual, and honestly? she's a baddie with a very specific job. let's get into it πŸŽ€


✨ NAME ✨

truncate_inode_pages β€” truncate all the pages from an offset 🫢

(like, emphasis on all, the manpage literally put asterisks around it, she's not being subtle)


🌸 SYNOPSIS 🌸

void truncate_inode_pages (struct address_space *mapping , loff_t lstart
);

void, no return value, no notes, no nothing β€” she does the thing and dips πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • mapping β€” the mapping you wanna truncate. that's the one, bestie 🎯
  • lstart β€” the offset you're truncating from. everything from here on out? gone βœ‚οΈ

πŸ’– DESCRIPTION πŸ’–

okay so the whole vibe here is: this gets called under β€” and is serialised by β€” inode->i_rwsem and mapping->invalidate_lock. so like, both locks, at the same time, no cap. πŸ”’πŸ”’ iykyk.


πŸ‘‘ NOTE πŸ‘‘

⚠️ bestie listen, this is the important bit ⚠️

when this function returns, there can still be a page in the process of deletion (it's inside __filemap_remove_folio) hanging out in the specified range. so mapping->nrpages can be non-zero when this function returns β€” even after truncating the whole entire mapping 😭

like she said she's done but one page is still in the group chat leaving. fr fr. not a bug, just the vibe 🌈


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./mm/truncate.c and her whole friend group:


and that's the page, periodt πŸ’œ

signing off from the ./mm directory, October 2026 edition of this very iconic Kernel API Manual entry β€” mwah, ily, go read truncate_inode_pages_range(9) next πŸ§šβ€β™€οΈβ­

πŸ“¦ where this page comes from