xa_find(9)
π xa_find β the Kernel API Manual, section 9, bestie edition β¨
okay so we're doing xa_find(9) today and honestly? she's iconic. this is the XArray girlies' entry point for finding stuff, and i'm gonna walk you through it like we're texting at 2am π«Ά
πΈ SYNOPSIS πΈ
void * xa_find (struct xarray *xa , unsigned long *indexp , unsigned long max , xa_mark_t filter );
four arguments, one pointer back out, no cap. let's get into it π
π ARGUMENTS π
xaβ bestie. it's the XArray. the whole vibe lives in here β¨indexpβ a pointer to an index. not the index itself, the pointer, okay? important. she's getting updated later, we'll get there πmaxβ the maximum index to search to. like a "do not pass go" line but for indices π§filterβ the selection criterion. this is the vibe check β what you're actually looking for π
β DESCRIPTION β
so here's the tea β β xa_find finds the entry in xa that matches the filter, and it picks the one with the lowest index that is at least indexp and no more than max. basically: the smallest eligible baddie in your range, first come first served π
if it does find an entry, it updates indexp to be the index of that entry. yes, it writes back through your pointer. that's the whole reason it's a pointer, iykyk π₯
β οΈ heads up: this function is protected by the RCU read lock, so it may not find entries which are being simultaneously added β if somebody's mid-insert, she simply didn't see it. no drama, that's just how she runs π
and another thing β she will not return an XA_RETRY_ENTRY. not her job, not her problem. if you need to see retry entries, use xas_find instead. different girl, different energy π
π¦ CONTEXT π¦
any context. literally any. she takes and releases the RCU lock herself, so she's low maintenance like that π
π RETURN π
the entry, if found. otherwise NULL. that's it. that's the whole return section. short and slay π
π§ SEE ALSO π§
kernel file ./lib/xarray.c β and honestly the whole xarray extended universe, all of it, right here bestie:
xas_load(9), xas_nomem(9), xas_free_nodes(9), xas_create_range(9), xas_store(9), xas_get_mark(9), xas_set_mark(9), xas_clear_mark(9), xas_init_marks(9), xas_split_alloc(9), xas_split(9), xas_try_split_min_order(9), xas_try_split(9), xas_pause(9), xas_find(9), xas_find_marked(9), xas_find_conflict(9), xa_load(9), __xa_erase(9), xa_erase(9), __xa_store(9), xa_store(9), __xa_cmpxchg(9), __xa_insert(9), xa_store_range(9), xas_get_order(9), xa_get_order(9), __xa_alloc(9), __xa_alloc_cyclic(9), __xa_set_mark(9), __xa_clear_mark(9), xa_get_mark(9), xa_set_mark(9), xa_clear_mark(9), xa_find_after(9), xa_extract(9), xa_delete_node(9), xa_destroy(9)
like. that's a whole friend group. go say hi π
mwah π this has been ./lib (the kernel API manual, section 9), version dated October 2026. go find your entry bestie, you got this πβ¨
π¦ 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