/**
- * maple_tree node explained
+ * DOC: maple_tree node explained
*
* Each node type has a number of slots for entries and a number of slots for
* pivots. In the case of dense nodes, the pivots are implied by the position
/**
- * Flags:
- * MAPLE_ALLOC_RANGE Use allocation ranges (tracks gaps) in this tree
- * MAPLE_USE_RCU Operate in read/copy/update mode for multi-readers
- * MAPLE_HEIGHT_OFFSET The position of the tree height in the flags
- * MAPLE_HEIGHT_MASK The mask for the maple tree height value
+ * DOC: Maple tree flags
+ *
+ * * MT_FLAGS_ALLOC_RANGE - Track gaps in this tree
+ * * MT_FLAGS_USE_RCU - Operate in RCU mode
+ * * MT_FLAGS_HEIGHT_OFFSET - The position of the tree height in the flags
+ * * MT_FLAGS_HEIGHT_MASK - The mask for the maple tree height value
+ * * MT_FLAGS_LOCK_MASK - How the mt_lock is used
+ * * MT_FLAGS_LOCK_IRQ - Acquired irq-safe
+ * * MT_FLAGS_LOCK_BH - Acquired bh-safe
+ * * MT_FLAGS_LOCK_EXTERN - mt_lock is not used
*
* MAPLE_HEIGHT_MAX The largest height that can be stored
*/
-#define MAPLE_ALLOC_RANGE 0x01
-#define MAPLE_USE_RCU 0x02
-#define MAPLE_HEIGHT_OFFSET 0x02
-#define MAPLE_HEIGHT_MASK 0x7C
+#define MT_FLAGS_ALLOC_RANGE 0x01
+#define MT_FLAGS_USE_RCU 0x02
+#define MT_FLAGS_HEIGHT_OFFSET 0x02
+#define MT_FLAGS_HEIGHT_MASK 0x7C
+#define MT_FLAGS_LOCK_MASK 0x300
+#define MT_FLAGS_LOCK_IRQ 0x100
+#define MT_FLAGS_LOCK_BH 0x200
+#define MT_FLAGS_LOCK_EXTERN 0x300
#define MAPLE_HEIGHT_MAX 31
#ifdef CONFIG_MAPLE_RCU_DISABLED
return false;
#endif
- return mt->ma_flags & MAPLE_USE_RCU;
+ return mt->ma_flags & MT_FLAGS_USE_RCU;
}
/**
* mt_clear_in_rcu() - Switch the tree to non-RCU mode.
return;
mtree_lock(mt);
- mt->ma_flags &= ~MAPLE_USE_RCU;
+ mt->ma_flags &= ~MT_FLAGS_USE_RCU;
mtree_unlock(mt);
}
return;
mtree_lock(mt);
- mt->ma_flags |= MAPLE_USE_RCU;
+ mt->ma_flags |= MT_FLAGS_USE_RCU;
mtree_unlock(mt);
}
static unsigned int mt_height(const struct maple_tree *mt)
{
- return (mt->ma_flags & MAPLE_HEIGHT_MASK) >> MAPLE_HEIGHT_OFFSET;
+ return (mt->ma_flags & MT_FLAGS_HEIGHT_MASK) >> MT_FLAGS_HEIGHT_OFFSET;
}
{
unsigned int new_flags = mas->tree->ma_flags;
- new_flags &= ~MAPLE_HEIGHT_MASK;
+ new_flags &= ~MT_FLAGS_HEIGHT_MASK;
BUG_ON(mas->depth > MAPLE_HEIGHT_MAX);
- new_flags |= mas->depth << MAPLE_HEIGHT_OFFSET;
+ new_flags |= mas->depth << MT_FLAGS_HEIGHT_OFFSET;
mas->tree->ma_flags = new_flags;
}
static inline bool mt_is_alloc(struct maple_tree *mt)
{
- return (mt->ma_flags & MAPLE_ALLOC_RANGE);
+ return (mt->ma_flags & MT_FLAGS_ALLOC_RANGE);
}
/*