Lines Matching full:mt

198 #define mt_lock_is_held(mt)                                             \  argument
199 (!(mt)->ma_external_lock || lock_is_held((mt)->ma_external_lock))
201 #define mt_write_lock_is_held(mt) \ argument
202 (!(mt)->ma_external_lock || \
203 lock_is_held_type((mt)->ma_external_lock, 0))
205 #define mt_set_external_lock(mt, lock) \ argument
206 (mt)->ma_external_lock = &(lock)->dep_map
208 #define mt_on_stack(mt) (mt).ma_external_lock = NULL argument
211 #define mt_lock_is_held(mt) 1 argument
212 #define mt_write_lock_is_held(mt) 1 argument
213 #define mt_set_external_lock(mt, lock) do { } while (0) argument
214 #define mt_on_stack(mt) do { } while (0) argument
271 #define mtree_lock(mt) spin_lock((&(mt)->ma_lock)) argument
273 spin_lock_nested((&(mt)->ma_lock), subclass)
274 #define mtree_unlock(mt) spin_unlock((&(mt)->ma_lock)) argument
326 void *mtree_load(struct maple_tree *mt, unsigned long index);
328 int mtree_insert(struct maple_tree *mt, unsigned long index,
330 int mtree_insert_range(struct maple_tree *mt, unsigned long first,
332 int mtree_alloc_range(struct maple_tree *mt, unsigned long *startp,
335 int mtree_alloc_cyclic(struct maple_tree *mt, unsigned long *startp,
338 int mtree_alloc_rrange(struct maple_tree *mt, unsigned long *startp,
342 int mtree_store_range(struct maple_tree *mt, unsigned long first,
344 int mtree_store(struct maple_tree *mt, unsigned long index,
346 void *mtree_erase(struct maple_tree *mt, unsigned long index);
348 int mtree_dup(struct maple_tree *mt, struct maple_tree *new, gfp_t gfp);
349 int __mt_dup(struct maple_tree *mt, struct maple_tree *new, gfp_t gfp);
351 void mtree_destroy(struct maple_tree *mt);
352 void __mt_destroy(struct maple_tree *mt);
356 * @mt: Maple Tree.
361 static inline bool mtree_empty(const struct maple_tree *mt) in mtree_empty() argument
363 return mt->ma_root == NULL; in mtree_empty()
482 #define MA_STATE(name, mt, first, end) \ argument
484 .tree = mt, \
618 void mt_dump(const struct maple_tree *mt, enum mt_dump_format format);
621 void mt_validate(struct maple_tree *mt);
785 static inline bool mt_external_lock(const struct maple_tree *mt) in mt_external_lock() argument
787 return (mt->ma_flags & MT_FLAGS_LOCK_MASK) == MT_FLAGS_LOCK_EXTERN; in mt_external_lock()
792 * @mt: Maple Tree
800 static inline void mt_init_flags(struct maple_tree *mt, unsigned int flags) in mt_init_flags() argument
802 mt->ma_flags = flags; in mt_init_flags()
803 if (!mt_external_lock(mt)) in mt_init_flags()
804 spin_lock_init(&mt->ma_lock); in mt_init_flags()
805 rcu_assign_pointer(mt->ma_root, NULL); in mt_init_flags()
810 * @mt: Maple Tree
816 static inline void mt_init(struct maple_tree *mt) in mt_init() argument
818 mt_init_flags(mt, 0); in mt_init()
821 static inline bool mt_in_rcu(struct maple_tree *mt) in mt_in_rcu() argument
826 return mt->ma_flags & MT_FLAGS_USE_RCU; in mt_in_rcu()
831 * @mt: The Maple Tree
833 static inline void mt_clear_in_rcu(struct maple_tree *mt) in mt_clear_in_rcu() argument
835 if (!mt_in_rcu(mt)) in mt_clear_in_rcu()
838 if (mt_external_lock(mt)) { in mt_clear_in_rcu()
839 WARN_ON(!mt_lock_is_held(mt)); in mt_clear_in_rcu()
840 mt->ma_flags &= ~MT_FLAGS_USE_RCU; in mt_clear_in_rcu()
842 mtree_lock(mt); in mt_clear_in_rcu()
843 mt->ma_flags &= ~MT_FLAGS_USE_RCU; in mt_clear_in_rcu()
844 mtree_unlock(mt); in mt_clear_in_rcu()
850 * @mt: The Maple Tree
852 static inline void mt_set_in_rcu(struct maple_tree *mt) in mt_set_in_rcu() argument
854 if (mt_in_rcu(mt)) in mt_set_in_rcu()
857 if (mt_external_lock(mt)) { in mt_set_in_rcu()
858 WARN_ON(!mt_lock_is_held(mt)); in mt_set_in_rcu()
859 mt->ma_flags |= MT_FLAGS_USE_RCU; in mt_set_in_rcu()
861 mtree_lock(mt); in mt_set_in_rcu()
862 mt->ma_flags |= MT_FLAGS_USE_RCU; in mt_set_in_rcu()
863 mtree_unlock(mt); in mt_set_in_rcu()
867 static inline unsigned int mt_height(const struct maple_tree *mt) in mt_height() argument
869 return (mt->ma_flags & MT_FLAGS_HEIGHT_MASK) >> MT_FLAGS_HEIGHT_OFFSET; in mt_height()
872 void *mt_find(struct maple_tree *mt, unsigned long *index, unsigned long max);
873 void *mt_find_after(struct maple_tree *mt, unsigned long *index,
875 void *mt_prev(struct maple_tree *mt, unsigned long index, unsigned long min);
876 void *mt_next(struct maple_tree *mt, unsigned long index, unsigned long max);