xa_extract(9)
π xa_extract(9) β the group-chat guide π
okay bestie, welcome to the Kernel API Manual, section 9, and today's main character is xa_extract. no cap, this one's genuinely a vibe. β¨
πΈ NAME πΈ
xa_extract β literally copies the entries you picked out of the XArray and drops them into a normal array. that's it, that's the whole gig. π
π¦ SYNOPSIS π¦
unsigned int xa_extract (struct xarray *xa , void **dst , unsigned long
start , unsigned long max , unsigned int n , xa_mark_t filter );
β ARGUMENTS β
xaβ the source XArray you're copying from. your origin story, if you will. πdstβ the buffer everything gets copied into. the destination, the glow-up location. π«Άstartβ the first index in the XArray that's even eligible to be selected. lower bound, bestie. πmaxβ the last index in the XArray eligible to be selected. upper bound, the cutoff. πΈnβ the maximum number of entries to copy. like a guest list with a capacity, respectfully. πfilterβ the selection criterion. who gets in, who doesn't. the bouncer, basically. π
β¨ DESCRIPTION β¨
so here's the teaaa: it copies up to n entries that match filter from the XArray, and the copied entries will have indices between start and max, inclusive. inclusive is the key word there, don't forget it. π
the filter can be an XArray mark value β in which case, entries that are marked with that mark get copied. it can also be XA_PRESENT, in which case all the entries that are not NULL get copied. simple as that. π
π«Ά important vibe check: the entries returned may not represent a snapshot of the XArray at a moment in time. lowkey the most important sentence on this whole page, ngl.
like, for example: if another thread stores to index 5, then index 10, calling xa_extract may return the old contents of index 5 and the new contents of index 10. it's giving "mixed eras" π. the good news though β indices not modified while this function is running will not be skipped. so nothing gets ghosted. π
if you need stronger guarantees, holding the xa_lock across calls to this function will prevent concurrent modification. that's the secure-the-bag move. π
π₯ CONTEXT π₯
any context, queen. it takes and releases the RCU lock. that's it. π
π RETURN π
the number of entries copied. that's the whole return value, no plot twist. π
π« SEE ALSO π«
kernel file ./lib/xarray.c, plus the whole extended friend group:
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(9), xa_find_after(9), xa_delete_node(9), xa_destroy(9)
k byeee, this page came from ./lib, dated October 2026 β mwah, slay, periodt π
β¨
π¦ 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