Skip to content
Commit 3ccaf57a authored by Matthew Wilcox's avatar Matthew Wilcox
Browse files

XArray: Add support for 1s-based allocation



A lot of places want to allocate IDs starting at 1 instead of 0.
While the xa_alloc() API supports this, it's not very efficient if lots
of IDs are allocated, due to having to walk down to the bottom of the
tree to see if ID 1 is available, then all the way over to the next
non-allocated ID.  This method marks ID 0 as being occupied which wastes
one slot in the XArray, but preserves xa_empty() as working.

Signed-off-by: default avatarMatthew Wilcox <willy@infradead.org>
parent fd9dc93e
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment