Currently, newly allocated nodes in xas_split_alloc are initialized immediately upon allocation. This occurs before the node's specific role, shift, and offset within the splitting hierarchy are determined. Move the call to __xas_init_node_for_split() from xas_split_alloc() to xas_split(). This removes any dependence on "entry" during node allocation, in preparation for extending xa_split* functions to support multi-level splits, where intermediate nodes need not have their slots initialized. Signed-off-by: Ackerley Tng --- After moving the call to __xas_init_node_for_split() from xas_split_alloc() to xas_split(), void *entry is unused and no longer needs to be passed to xas_split_alloc(). I would like to get feedback on moving initialization into xas_split() before making a full refactoring to remove void *entry as a parameter to xas_split_alloc(). lib/xarray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xarray.c b/lib/xarray.c index edb877c2d51c..636edcf014f1 100644 --- a/lib/xarray.c +++ b/lib/xarray.c @@ -1060,7 +1060,6 @@ void xas_split_alloc(struct xa_state *xas, void *entry, unsigned int order, if (!node) goto nomem; - __xas_init_node_for_split(xas, node, entry); RCU_INIT_POINTER(node->parent, xas->xa_alloc); xas->xa_alloc = node; } while (sibs-- > 0); @@ -1103,6 +1102,7 @@ void xas_split(struct xa_state *xas, void *entry, unsigned int order) struct xa_node *child = xas->xa_alloc; xas->xa_alloc = rcu_dereference_raw(child->parent); + __xas_init_node_for_split(xas, child, entry); child->shift = node->shift - XA_CHUNK_SHIFT; child->offset = offset; child->count = XA_CHUNK_SIZE; -- 2.52.0.rc1.455.g30608eb744-goog