]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Use MAS_BUG_ON() prior to calling mas_meta_gap()
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 1 Sep 2022 20:29:29 +0000 (16:29 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Mon, 13 Feb 2023 13:42:04 +0000 (08:42 -0500)
Replace the call to BUG_ON() in mas_meta_gap() with calls before the
function call MAS_BUG_ON() to get more information on error condition.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c

index 1947160ba5599a9eff4455488454b40ce4f40459..07b59be749c36637e24016c238c28021bc822f8d 100644 (file)
@@ -905,8 +905,6 @@ static inline unsigned char ma_meta_end(struct maple_node *mn,
 static inline unsigned char ma_meta_gap(struct maple_node *mn,
                                        enum maple_type mt)
 {
-       BUG_ON(mt != maple_arange_64);
-
        return mn->ma64.meta.gap;
 }
 
@@ -1557,6 +1555,7 @@ static inline unsigned long mas_max_gap(struct ma_state *mas)
                return mas_leaf_max_gap(mas);
 
        node = mas_mn(mas);
+       MAS_BUG_ON(mas, mt != maple_arange_64);
        offset = ma_meta_gap(node, mt);
        if (offset == MAPLE_ARANGE64_META_MAX)
                return 0;
@@ -1590,6 +1589,7 @@ static inline void mas_parent_gap(struct ma_state *mas, unsigned char offset,
        pgaps = ma_gaps(pnode, pmt);
 
 ascend:
+       MAS_BUG_ON(mas, pmt != maple_arange_64);
        meta_offset = ma_meta_gap(pnode, pmt);
        if (meta_offset == MAPLE_ARANGE64_META_MAX)
                meta_gap = 0;