cache_subtree_search(9)
β¨ cache_subtree_search(9) β¨
okay bestie so we're diving into the Kernel API Manual today β this one's cache_subtree_search(9) and it's literally the little function that goes hunting through the cache tree for your key ππ
πΈ NAME πΈ
cache_subtree_search β Search for a key in the cache tree.
like... it searches, babes. that's the whole gig π
π¦ SYNOPSIS π¦
struct rb_node * cache_subtree_search (struct pcache_cache_subtree
*cache_subtree , struct pcache_cache_key *key , struct rb_node **parentp
, struct rb_node ***newp , struct list_head *delete_key_list );
not me presenting you with five parameters, but honestly she ate π
π ARGUMENTS π
cache_subtreeβ Pointer to the cache tree structure. your main character tree, the one we're searching β¨keyβ Pointer to the cache key to search for. the thing we're looking for, bestie, like when you can't find your airpods but they're literally in your pocket πparentpβ Pointer to store the parent node of the found node. this is where the parent of the found node goes πnewpβ Pointer to store the location where the new node should be inserted. yes it's a triple pointer. yes we're both going through it π but she's storing where the new node should be inserted, slaydelete_key_listβ List to collect invalid keys for deletion. the β¨cleanup committeeβ¨ β anything invalid found along the way gets tossed in here
π DESCRIPTION π
so here's the vibe π this function searches the cache tree for a specific key and returns the node that is the predecessor of the key β or the first node if the key is less than all keys in the tree. lowkey iconic behavior honestly π
and if any invalid keys are found during the search, they get added to the delete_key_list for later cleanup. no cap, we clean as we go π§Ήβ¨
and like, the whole point: it returns a pointer to the previous node. struct rb_node * out the door, periodt π
π₯ SEE ALSO π₯
- Kernel file
./drivers/md/dm-pcache/cache_key.c cache_key_get(9)cache_key_destroy(9)cache_key_append(9)cache_subtree_walk(9)fixup_overlap_tail(9)fixup_overlap_contain(9)fixup_overlap_contained(9)fixup_overlap_head(9)cache_key_insert(9)clean_fn(9)
iykyk, go read all of them, they're a whole friend group fr fr π«Άπ¦
π okay that's the page!! this little manual lives in ./drivers/md/dm-pcache and it's dated October 2026 β shoutout to the kernel docs from the future, we love to see it βπΈ mwah, go search some trees bestie ππ
π¦ 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