mapping_try_invalidate(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… mapping_try_invalidate β€” Kernel API Manual ✨

okay so bestie, let me tell you about mapping_try_invalidate β€” it's a kernel function and honestly it's giving very "I tried my best and I'm telling you exactly what didn't work" energy πŸ’–


πŸ¦‹ NAME πŸ¦‹

mapping_try_invalidate β€” invalidate all the evictable folios of one inode, no cap πŸŽ€


✨ SYNOPSIS ✨

unsigned long mapping_try_invalidate (struct address_space *mapping ,
pgoff_t start , pgoff_t end , unsigned long *nr_failed );

literally the whole signature, copy it exactly, do not touch a single character πŸ’…


🌸 ARGUMENTS 🌸

  • mapping β€” the address_space which holds the folios to invalidate. yes bestie, this is the container we're cleaning out πŸ”₯
  • start β€” the offset 'from' which to invalidate. where the chaos begins ⭐
  • end β€” the offset 'to' which to invalidate (inclusive). inclusive is doing so much work in that sentence, don't forget it 🫢
  • nr_failed β€” how many folio invalidations failed. the receipts, basically 😭

πŸ’œ DESCRIPTION πŸ’œ

so this function is similar to invalidate_mapping_pages, except β€” and this is the main character moment β€” it returns the number of folios which could not be evicted in nr_failed. like, not just "did it work?" but "here's exactly how many didn't, bestie" πŸ‘‘

ngl that's the whole difference, but it's an important one, so remember it πŸ’€

🌈 SEE ALSO 🌈

Kernel file ./mm/truncate.c: folio_invalidate(9), mapping_evict_folio(9), truncate_inode_pages_range(9), truncate_inode_pages(9), truncate_inode_pages_final(9), invalidate_mapping_pages(9), invalidate_inode_pages2_range(9), invalidate_inode_pages2(9), truncate_pagecache(9), truncate_setsize(9), pagecache_isize_extended(9), truncate_pagecache_range(9)

like a whole friend group of truncate and invalidate functions, iykyk 🧚


okay that's the page!! this lil doc lives in ./mm, October 2026 edition, and it's filed under mapping_try_invalidate(9) β€” slay, go read the other ones too πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from