Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
return mas->alloc;
}
+int mas_entry_cnt(struct ma_state *mas, unsigned long nr_entries) {
+ int nonleaf_cap = MAPLE_ARANGE64_SLOTS - 1;
+ int nr_leaves;
+
+ if (!mt_is_alloc(mas->tree))
+ nonleaf_cap = MAPLE_RANGE64_SLOTS - 1;
+
+ nr_leaves = DIV_ROUND_UP(nr_entries, MAPLE_RANGE64_SLOTS);
+ mas_node_cnt(mas, nr_leaves + DIV_ROUND_UP(nr_leaves, nonleaf_cap));
+ if (!mas_is_err(mas))
+ return 0;
+ return xa_err(mas->node);
+
+}
/*
* Sets up maple state for operations by setting mas->min = 0 & mas->node to
* certain values.