}
}
+static inline bool mt_locked(const struct maple_tree *mt)
+{
+ return ((mt->ma_flags & MT_FLAGS_LOCK_MASK) == MT_FLAGS_LOCK_EXTERN) ||
+ lockdep_is_held(&mt->ma_lock);
+}
+
static inline void *mt_slot(const struct maple_tree *mt,
void __rcu **slots, unsigned char offset)
{
- return rcu_dereference_check(slots[offset],
- lockdep_is_held(&mt->ma_lock));
+ return rcu_dereference_check(slots[offset], mt_locked(mt));
}
/*
static inline void *mas_slot_locked(struct ma_state *mas, void __rcu **slots,
unsigned char offset)
{
- return rcu_dereference_protected(slots[offset],
- lockdep_is_held(&mas->tree->ma_lock));
+ return rcu_dereference_protected(slots[offset], mt_locked(mas->tree));
}
/*
*/
static inline void *mas_root(struct ma_state *mas)
{
- return rcu_dereference_check(mas->tree->ma_root,
- lockdep_is_held(&mas->tree->ma_lock));
+ return rcu_dereference_check(mas->tree->ma_root, mt_locked(mas->tree));
}
static inline void *mt_root_locked(const struct maple_tree *mt)
{
- return rcu_dereference_protected(mt->ma_root,
- lockdep_is_held(&mt->ma_lock));
+ return rcu_dereference_protected(mt->ma_root, mt_locked(mt));
}
/*
void mt_dump(const struct maple_tree *mt)
{
- void *entry = rcu_dereference_check(mt->ma_root,
- lockdep_is_held(&mt->ma_lock));
+ void *entry = rcu_dereference_check(mt->ma_root, mt_locked(mt));
pr_info("maple_tree("MA_PTR") flags %X, height %u root "MA_PTR"\n",
mt, mt->ma_flags, mt_height(mt), entry);