]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Remove maple_retry define and use MAS_START
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 7 Dec 2018 20:46:46 +0000 (15:46 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 7 Dec 2018 20:46:46 +0000 (15:46 -0500)
Also fix an error in the error recovery path of mtree_insert_range.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
include/linux/maple_tree.h
lib/maple_tree.c

index 31df0fe1ad8ca57f18dbe382d58cf6d4485b1497..dd7d428db032863e3a8249db2b2a1a4ea33d7c19 100644 (file)
@@ -34,7 +34,6 @@
 
 #define MAPLE_NODE4_MAX_SLOT 15
 #define MAPLE_NODE4M_MAX_SLOT 14
-#define maple_retry(ms) ((ms)->tree)
 
 struct maple_node;
 /* Node 64 looks at all 64 bits of a number to decide pivots */
index 33ebbb0ddbb8eca1862a59247231d7f2425a9bbe..d7b605d609b93d529afcb3622401baf8cf6ad1bd 100644 (file)
@@ -101,10 +101,7 @@ static inline bool maple_is_root(struct maple_state *ms,
 
 static inline bool _maple_is_node_4(struct maple_state *ms)
 {
-       /* FIXME: This just means that our node could be contained within a
-        * node_4.  This could happen when shrinking a node_64, for example.
-        */
-       return false;
+       return false; /* FIXME: Disabled */
        if (maple_is_root(ms, ms->node))
                return false;
 
@@ -627,7 +624,7 @@ static void *_maple_setup_insert(struct maple_state *ms)
                        return entry;
                err = _maple_root_expand(ms);
                if (err == -ENOMEM)
-                       return maple_retry(ms);
+                       return MAS_START;
 
                return NULL;
        }
@@ -643,15 +640,12 @@ static void *_maple_setup_insert(struct maple_state *ms)
                }
                if (_maple_node_is_full(ms)) {
                        int ret = _maple_node_split(ms);
-
                        /*
                         * If the allocation fails, we need to drop the lock
                         * and restart the walk from root.
                         */
                        if (ret == -ENOMEM)
-                               return maple_retry(ms);
-                       if (ret == -EINVAL) // FIXME: root expand on split may return an invalid insert.
-                               return maple_retry(ms);
+                               return MAS_START;
                }
 
                entry = _maple_walk_64(ms, ms->index);
@@ -727,10 +721,10 @@ int mtree_insert_range(struct maple_tree *mt, unsigned long start,
        spin_lock(&ms.tree->lock);
 retry:
        walked = _maple_setup_insert(&ms);
+       if (walked == MAS_START)
+               goto retry;
        if (walked != NULL)
                goto already_exists;
-       if (walked == maple_retry(&ms))
-               goto retry;
 
        ret = _maple_insert(&ms, entry);
        if (ret == -ENOMEM) {