summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yang <richard.weiyang@gmail.com>2024-11-16 02:48:04 +0100
committerAndrew Morton <akpm@linux-foundation.org>2025-01-14 07:40:39 +0100
commitf5bd418727856b104d6dcb43b144381c31250383 (patch)
treea245fe6da2d04437bd5e669dc0431d06d1bb075b
parentmaple_tree: index has been checked to be smaller than pivot (diff)
downloadlinux-f5bd418727856b104d6dcb43b144381c31250383.tar.xz
linux-f5bd418727856b104d6dcb43b144381c31250383.zip
maple_tree: not possible to be a root node after loop
Empty tree and single entry tree is handled else whether, so the maple tree here must be a tree with nodes. If the height is 1 and we found the gap, it will jump to *done* since it is also a leaf. If the height is more than one, and there may be an available range, we will descend the tree, which is not root anymore. If there is no available range, we will set error and return. This means the check for root node here is not necessary. Link: https://lkml.kernel.org/r/20241116014805.11547-3-richard.weiyang@gmail.com Signed-off-by: Wei Yang <richard.weiyang@gmail.com> Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com> Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--lib/maple_tree.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 57603524e2dd..3174234d77cb 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -4880,7 +4880,7 @@ static inline bool mas_anode_descend(struct ma_state *mas, unsigned long size)
if (gap >= size) {
if (ma_is_leaf(type)) {
found = true;
- goto done;
+ break;
}
mas->node = mas_slot(mas, slots, offset);
@@ -4897,9 +4897,6 @@ next_slot:
}
}
- if (mte_is_root(mas->node))
- found = true;
-done:
mas->offset = offset;
return found;
}