};
#define mt_node_max(x) mt_max[mte_node_type(x)]
-
unsigned char mt_slots[] = {
[maple_dense] = MAPLE_NODE_SLOTS,
[maple_sparse_6] = MAPLE_SPARSE6_SLOTS,
#define mt_min_slot_cnt(x) mt_min_slots[mte_node_type(x)]
#define MAPLE_BIG_NODE_SLOTS (MAPLE_NODE_SLOTS * 2 + 1)
+
struct maple_big_node {
struct maple_pnode *parent;
struct maple_enode *slot[MAPLE_BIG_NODE_SLOTS];
{
return mte_get_rcu_slot(mas->node, slot, mas->tree);
}
-/* Private
- * mte_destroy_walk: Free the sub-tree from @mn and below.
+/** Private
+ * mte_destroy_walk() - Free the sub-tree from @mn and below.
+ *
+ * @mn - the head of the sub-tree to free.
+ * @mtree - the maple tree that includes @mn (for type)
*/
void mte_destroy_walk(struct maple_enode *mn, struct maple_tree *mtree)
{
}
}
-
+/** Private
+ * ma_set_rcu_slot() - Set a nodes rcu slot.
+ *
+ * @mn - the maple node for the operation
+ * @slot - the slot number to set
+ * @type - the maple node type
+ * @val - the value to store
+ */
static inline void ma_set_rcu_slot(struct maple_node *mn,
unsigned char slot, enum maple_type type, void *val)
{
break;
}
}
+/** Private
+ * mte_set_rcu_slot() - Set an encoded nodes rcu slot.
+ */
static inline void mte_set_rcu_slot(const struct maple_enode *mn,
unsigned char slot, void *val)
{
ma_set_rcu_slot(mte_to_node(mn), slot, mte_node_type(mn), val);
}
-
+/** Private
+ * mas_dup_state() - duplicate the internal state of a ma_state.
+ *
+ * @dst - the destination to store the state information
+ * @src - the source of the state information
+ */
static inline void mas_dup_state(struct ma_state *dst, struct ma_state *src)
{
dst->tree = src->tree;
dst->min = src->min;
mas_set_slot(dst, mas_get_slot(src));
}
+/** Private
+ * mas_descend() - Descend into the slot stored in the ma_state.
+ *
+ * @mas - the maple state.
+ */
static inline void mas_descend(struct ma_state *mas)
{
unsigned char slot = mas_get_slot(mas);
mas->node = mas_get_rcu_slot(mas, mas_get_slot(mas));
}
-static inline void mte_update_rcu_slot(const struct maple_enode *mn,
- unsigned char slot, void *val)
-{
- enum maple_type type = mte_node_type(mn);
-
- switch (type) {
- case maple_range_64:
- case maple_leaf_64:
- rcu_assign_pointer(mte_to_node(mn)->mr64.slot[slot], val);
- break;
- default:
- case maple_dense:
- rcu_assign_pointer(mte_to_node(mn)->slot[slot], val);
- break;
- case maple_arange_64:
- rcu_assign_pointer(mte_to_node(mn)->ma64.slot[slot], val);
- break;
- case maple_sparse_6:
- rcu_assign_pointer(mte_to_node(mn)->ms6.slot[slot], val);
- break;
- case maple_sparse_9:
- rcu_assign_pointer(mte_to_node(mn)->ms9.slot[slot], val);
- break;
- case maple_sparse_16:
- rcu_assign_pointer(mte_to_node(mn)->ms16.slot[slot], val);
- break;
- case maple_sparse_21:
- rcu_assign_pointer(mte_to_node(mn)->ms21.slot[slot], val);
- break;
- case maple_sparse_32:
- rcu_assign_pointer(mte_to_node(mn)->ms32.slot[slot], val);
- break;
- case maple_sparse_64:
- rcu_assign_pointer(mte_to_node(mn)->ms64.slot[slot], val);
- break;
- case maple_range_16:
- case maple_leaf_16:
- rcu_assign_pointer(mte_to_node(mn)->mr16.slot[slot], val);
- break;
- case maple_range_32:
- case maple_leaf_32:
- rcu_assign_pointer(mte_to_node(mn)->mr32.slot[slot], val);
- break;
- }
-}
-
static inline unsigned long ma_get_gap(const struct maple_node *mn,
unsigned char gap, enum maple_type type)
{
rcu_assign_pointer(mas->tree->ma_root, mte_mk_root(mas->node));
mas->tree->ma_height = mas->depth;
} else {
- mte_update_rcu_slot(parent, slot, mas->node);
+ mte_set_rcu_slot(parent, slot, mas->node);
}
if (!advanced) {