mtree_erase(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… mtree_erase(9) β€” kernel API manual, bestie edition

okay so like, welcome to the mtree_erase page β€” it lives in section 9 of the kernel API manual and it is, lowkey, one of the most useful little gremlins in the maple tree family. sit down, grab a strawberry πŸ“, we're gonna get into it.


✨ NAME ✨

mtree_erase β€” find an index and erase the entire range. no crumbs left, periodt.


πŸŽ€ SYNOPSIS πŸŽ€

void * mtree_erase (struct maple_tree *mt , unsigned long index );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • mt β€” the maple tree. your main character. 🌳
  • index β€” the index you wanna erase. very "you know exactly which one" energy.

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea: erasing is literally the same as doing a walk to an entry and then storing a NULL to that ENTIRE range. like, that's the whole vibe. in fact β€” and this is the fun part β€” it's actually implemented as exactly that, using the advanced API. no cap. πŸ”₯

real talk though: erase requires allocations, and it'll use GFP_KERNEL | __GFP_NOFAIL to get them if it has to. and if the allocation fails? the internal lock gets dropped to retry. so like… it will come through for you, but bestie, know what you're asking for. 😭

πŸ‘‘ RETURN πŸ‘‘

the entry stored at the index, or NULL. that's it, that's the answer. 🫢


🌈 SEE ALSO 🌈

kernel file ./lib/maple_tree.c


and that's the whole page, bestie πŸ’œ this icon came from ./lib and it's dated October 2026 β€” mtree_erase(9), signed, sealed, slayed. go erase something responsibly βœ¨πŸŽ€

πŸ“¦ where this page comes from