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, \
604 void mt_dump(const struct maple_tree *mt, enum mt_dump_format format);
607 void mt_validate(struct maple_tree *mt);
771 static inline bool mt_external_lock(const struct maple_tree *mt) in mt_external_lock() argument
773 return (mt->ma_flags & MT_FLAGS_LOCK_MASK) == MT_FLAGS_LOCK_EXTERN; in mt_external_lock()
778 * @mt: Maple Tree
786 static inline void mt_init_flags(struct maple_tree *mt, unsigned int flags) in mt_init_flags() argument
788 mt->ma_flags = flags; in mt_init_flags()
789 if (!mt_external_lock(mt)) in mt_init_flags()
790 spin_lock_init(&mt->ma_lock); in mt_init_flags()
791 rcu_assign_pointer(mt->ma_root, NULL); in mt_init_flags()
796 * @mt: Maple Tree
802 static inline void mt_init(struct maple_tree *mt) in mt_init() argument
804 mt_init_flags(mt, 0); in mt_init()
807 static inline bool mt_in_rcu(struct maple_tree *mt) in mt_in_rcu() argument
812 return mt->ma_flags & MT_FLAGS_USE_RCU; in mt_in_rcu()
817 * @mt: The Maple Tree
819 static inline void mt_clear_in_rcu(struct maple_tree *mt) in mt_clear_in_rcu() argument
821 if (!mt_in_rcu(mt)) in mt_clear_in_rcu()
824 if (mt_external_lock(mt)) { in mt_clear_in_rcu()
825 WARN_ON(!mt_lock_is_held(mt)); in mt_clear_in_rcu()
826 mt->ma_flags &= ~MT_FLAGS_USE_RCU; in mt_clear_in_rcu()
828 mtree_lock(mt); in mt_clear_in_rcu()
829 mt->ma_flags &= ~MT_FLAGS_USE_RCU; in mt_clear_in_rcu()
830 mtree_unlock(mt); in mt_clear_in_rcu()
836 * @mt: The Maple Tree
838 static inline void mt_set_in_rcu(struct maple_tree *mt) in mt_set_in_rcu() argument
840 if (mt_in_rcu(mt)) in mt_set_in_rcu()
843 if (mt_external_lock(mt)) { in mt_set_in_rcu()
844 WARN_ON(!mt_lock_is_held(mt)); in mt_set_in_rcu()
845 mt->ma_flags |= MT_FLAGS_USE_RCU; in mt_set_in_rcu()
847 mtree_lock(mt); in mt_set_in_rcu()
848 mt->ma_flags |= MT_FLAGS_USE_RCU; in mt_set_in_rcu()
849 mtree_unlock(mt); in mt_set_in_rcu()
853 static inline unsigned int mt_height(const struct maple_tree *mt) in mt_height() argument
855 return (mt->ma_flags & MT_FLAGS_HEIGHT_MASK) >> MT_FLAGS_HEIGHT_OFFSET; in mt_height()
858 void *mt_find(struct maple_tree *mt, unsigned long *index, unsigned long max);
859 void *mt_find_after(struct maple_tree *mt, unsigned long *index,
861 void *mt_prev(struct maple_tree *mt, unsigned long index, unsigned long min);
862 void *mt_next(struct maple_tree *mt, unsigned long index, unsigned long max);