Lines Matching full:mt

185 #define mt_lock_is_held(mt)                                             \  argument
186 (!(mt)->ma_external_lock || lock_is_held((mt)->ma_external_lock))
188 #define mt_write_lock_is_held(mt) \ argument
189 (!(mt)->ma_external_lock || \
190 lock_is_held_type((mt)->ma_external_lock, 0))
192 #define mt_set_external_lock(mt, lock) \ argument
193 (mt)->ma_external_lock = &(lock)->dep_map
195 #define mt_on_stack(mt) (mt).ma_external_lock = NULL argument
198 #define mt_lock_is_held(mt) 1 argument
199 #define mt_write_lock_is_held(mt) 1 argument
200 #define mt_set_external_lock(mt, lock) do { } while (0) argument
201 #define mt_on_stack(mt) do { } while (0) argument
258 #define mtree_lock(mt) spin_lock((&(mt)->ma_lock)) argument
260 spin_lock_nested((&(mt)->ma_lock), subclass)
261 #define mtree_unlock(mt) spin_unlock((&(mt)->ma_lock)) argument
313 void *mtree_load(struct maple_tree *mt, unsigned long index);
315 int mtree_insert(struct maple_tree *mt, unsigned long index,
317 int mtree_insert_range(struct maple_tree *mt, unsigned long first,
319 int mtree_alloc_range(struct maple_tree *mt, unsigned long *startp,
322 int mtree_alloc_rrange(struct maple_tree *mt, unsigned long *startp,
326 int mtree_store_range(struct maple_tree *mt, unsigned long first,
328 int mtree_store(struct maple_tree *mt, unsigned long index,
330 void *mtree_erase(struct maple_tree *mt, unsigned long index);
332 int mtree_dup(struct maple_tree *mt, struct maple_tree *new, gfp_t gfp);
333 int __mt_dup(struct maple_tree *mt, struct maple_tree *new, gfp_t gfp);
335 void mtree_destroy(struct maple_tree *mt);
336 void __mt_destroy(struct maple_tree *mt);
340 * @mt: Maple Tree.
345 static inline bool mtree_empty(const struct maple_tree *mt) in mtree_empty() argument
347 return mt->ma_root == NULL; in mtree_empty()
465 #define MA_STATE(name, mt, first, end) \ argument
467 .tree = mt, \
583 void mt_dump(const struct maple_tree *mt, enum mt_dump_format format);
586 void mt_validate(struct maple_tree *mt);
750 static inline bool mt_external_lock(const struct maple_tree *mt) in mt_external_lock() argument
752 return (mt->ma_flags & MT_FLAGS_LOCK_MASK) == MT_FLAGS_LOCK_EXTERN; in mt_external_lock()
757 * @mt: Maple Tree
765 static inline void mt_init_flags(struct maple_tree *mt, unsigned int flags) in mt_init_flags() argument
767 mt->ma_flags = flags; in mt_init_flags()
768 if (!mt_external_lock(mt)) in mt_init_flags()
769 spin_lock_init(&mt->ma_lock); in mt_init_flags()
770 rcu_assign_pointer(mt->ma_root, NULL); in mt_init_flags()
775 * @mt: Maple Tree
781 static inline void mt_init(struct maple_tree *mt) in mt_init() argument
783 mt_init_flags(mt, 0); in mt_init()
786 static inline bool mt_in_rcu(struct maple_tree *mt) in mt_in_rcu() argument
791 return mt->ma_flags & MT_FLAGS_USE_RCU; in mt_in_rcu()
796 * @mt: The Maple Tree
798 static inline void mt_clear_in_rcu(struct maple_tree *mt) in mt_clear_in_rcu() argument
800 if (!mt_in_rcu(mt)) in mt_clear_in_rcu()
803 if (mt_external_lock(mt)) { in mt_clear_in_rcu()
804 WARN_ON(!mt_lock_is_held(mt)); in mt_clear_in_rcu()
805 mt->ma_flags &= ~MT_FLAGS_USE_RCU; in mt_clear_in_rcu()
807 mtree_lock(mt); in mt_clear_in_rcu()
808 mt->ma_flags &= ~MT_FLAGS_USE_RCU; in mt_clear_in_rcu()
809 mtree_unlock(mt); in mt_clear_in_rcu()
815 * @mt: The Maple Tree
817 static inline void mt_set_in_rcu(struct maple_tree *mt) in mt_set_in_rcu() argument
819 if (mt_in_rcu(mt)) in mt_set_in_rcu()
822 if (mt_external_lock(mt)) { in mt_set_in_rcu()
823 WARN_ON(!mt_lock_is_held(mt)); in mt_set_in_rcu()
824 mt->ma_flags |= MT_FLAGS_USE_RCU; in mt_set_in_rcu()
826 mtree_lock(mt); in mt_set_in_rcu()
827 mt->ma_flags |= MT_FLAGS_USE_RCU; in mt_set_in_rcu()
828 mtree_unlock(mt); in mt_set_in_rcu()
832 static inline unsigned int mt_height(const struct maple_tree *mt) in mt_height() argument
834 return (mt->ma_flags & MT_FLAGS_HEIGHT_MASK) >> MT_FLAGS_HEIGHT_OFFSET; in mt_height()
837 void *mt_find(struct maple_tree *mt, unsigned long *index, unsigned long max);
838 void *mt_find_after(struct maple_tree *mt, unsigned long *index,
840 void *mt_prev(struct maple_tree *mt, unsigned long index, unsigned long min);
841 void *mt_next(struct maple_tree *mt, unsigned long index, unsigned long max);