[PATCH 9/9] XArray: adjust xa_offset till it gets the correct node

From: Wei Yang
Date: Mon Mar 30 2020 - 08:37:33 EST


During xas_create_range(), it will go up the tree for next create.

Currently, during moving up the tree, the xa_offset is adjusted every
thime. This is not necessary. Only the offset for the last one matters.

Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
---
lib/xarray.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/xarray.c b/lib/xarray.c
index 01f64a000e14..9546b2b2dce1 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -712,9 +712,10 @@ void xas_create_range(struct xa_state *xas)
for (;;) {
struct xa_node *node = xas->xa_node;
xas->xa_node = xa_parent_locked(xas->xa, node);
- xas->xa_offset = node->offset - 1;
- if (node->offset != 0)
+ if (node->offset != 0) {
+ xas->xa_offset = node->offset - 1;
break;
+ }
}
}

--
2.23.0