From f4ccfc6bb7627f0ce7ff423b75b2de76ff725157 Mon Sep 17 00:00:00 2001 From: "Matthew Wilcox (Oracle)" Date: Sat, 12 Oct 2019 23:16:46 -0400 Subject: [PATCH] maple_tree: Add mas_set() and mas_set_range() The equivalent of xas_set() Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/maple_tree.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index eb1626010935..327162a762cb 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -332,4 +332,36 @@ void maple_tree_init(void); for (entry = mt_find(mt, index, max); \ entry; entry = mt_find_after(mt, &index, max)) +/* + * mas_set_range() - Set up Maple Tree operation state for a different index. + * @xas: Maple Tree operation state. + * @start: New start of range in the Maple Tree. + * @last: New end of range in the Maple Tree. + * + * Move the operation state to refer to a different range. This will + * have the effect of starting a walk from the top; see mas_next() + * to move to an adjacent index. + */ +static inline void mas_set_range(struct ma_state *mas, unsigned long start, + unsigned long last) +{ + mas->index = start; + mas->last = last; + mas->node = MAS_START; +} + +/** + * mas_set() - Set up Maple Tree operation state for a different index. + * @xas: Maple Tree operation state. + * @index: New index into the Maple Tree. + * + * Move the operation state to refer to a different index. This will + * have the effect of starting a walk from the top; see mas_next() + * to move to an adjacent index. + */ +static inline void mas_set(struct ma_state *mas, unsigned long index) +{ + mas_set_range(mas, index, index); +} + #endif -- 2.50.1