[PATCH 5/9] XArray: entry in last level is not expected to be a node

Wei Yang
2020-03-30T12:37:25Z

If an entry is at the last level, whose parent's shift is 0, it is not
expected to be a node. We can just leverage the xa_is_node() check to
break the loop instead of check shift additionally.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
lib/xarray.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/lib/xarray.c b/lib/xarray.c
index e08a0388a156..0c5b44def3aa 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -238,8 +238,6 @@ void *xas_load(struct xa_state *xas)
if (xas->xa_shift > node->shift)
break;
entry = xas_descend(xas, node);
- if (node->shift == 0)
- break;
}
return entry;
}
--
2.23.0