From 1ac3568adc968ecfea412e6f7994cc746a17bbf5 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Fri, 7 Dec 2018 15:46:46 -0500 Subject: [PATCH] maple_tree: Remove maple_retry define and use MAS_START Also fix an error in the error recovery path of mtree_insert_range. Signed-off-by: Liam R. Howlett --- include/linux/maple_tree.h | 1 - lib/maple_tree.c | 16 +++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index 31df0fe1ad8ca..dd7d428db0328 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -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 */ diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 33ebbb0ddbb8e..d7b605d609b93 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -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) { -- 2.50.1