}
}
-static inline void *mas_slot_protected(struct ma_state *mas, void **slots,
+static inline void *mas_slot_locked(struct ma_state *mas, void **slots,
unsigned char offset)
{
if (mt_in_rcu(mas->tree))
offset);
}
+static inline void *mas_root(struct ma_state *mas)
+{
+ if (mt_in_rcu(mas->tree))
+ return rcu_dereference(mas->tree->ma_root)
+
+ return mas->tree->ma_root;
+}
+
+static inline void *mas_root_locked(struct ma_state *mas)
+{
+ if (mt_in_rcu(mas->tree))
+ return rcu_dereference_protected(mas->tree->ma_root,
+ lockdep_is_held(&mas->tree->ma_lock));
+
+ return mas->tree->ma_root;
+}
/*
* ma_set_slot() - Set a nodes rcu slot.
*
if (ma_is_dense(mt)) {
for (i = 0; i < mt_slot_count(mas->node); i++) {
- if (mas_slot_protected(mas, slots, i)) {
+ if (mas_slot_locked(mas, slots, i)) {
if (gap > max_gap)
max_gap = gap;
gap = 0;
reused_node:
mas_update_gap(mas);
return 2;
-
}
static inline int mas_root_expand(struct ma_state *mas, void *entry)
{
- void *contents = rcu_dereference_protected(mas->tree->ma_root,
- lockdep_is_held(&mas->tree->ma_lock));
+ void *contents = mas_root_locked(mas);
enum maple_type type = maple_leaf_64;
int slot = 0;
return 0;
if (mas->tree->ma_root && mas->last == 0) {
- contents = rcu_dereference_protected(mas->tree->ma_root,
- lockdep_is_held(&mas->tree->ma_lock));
+ contents = mas_root_locked(mas);
if (!overwrite)
goto exists;
} else {