mtree_erase(9)
π 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
mas_prealloc_calc(9)mas_wr_preallocate(9)mas_insert(9)mas_alloc_cyclic(9)mas_walk(9)mte_dead_walk(9)mt_free_walk(9)mas_store(9)mas_store_gfp(9)mas_store_prealloc(9)mas_preallocate(9)mas_next(9)mas_next_range(9)mt_next(9)mas_prev(9)mas_prev_range(9)mt_prev(9)mas_pause(9)mas_find_setup(9)mas_find(9)mas_find_range(9)mas_find_rev_setup(9)mas_find_rev(9)mas_find_range_rev(9)mas_erase(9)mas_nomem(9)mas_nomem_nofail(9)mtree_load(9)mtree_store_range(9)mtree_store(9)mtree_insert_range(9)mtree_insert(9)mtree_alloc_cyclic(9)__mt_dup(9)mtree_dup(9)__mt_destroy(9)mtree_destroy(9)mt_find(9)mt_find_after(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms