From 69866e41f78e58ff55e354ea2f1812b1cf139e49 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 | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index ad7f0af2794b..3219fec8965b 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -303,4 +303,37 @@ void *mas_find(struct ma_state *mas, unsigned long max); bool mas_nomem(struct ma_state *mas, gfp_t gfp); void mas_pause(struct ma_state *mas); void maple_tree_init(void); + +/** + * 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