summaryrefslogtreecommitdiff
path: root/lib/xarray.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xarray.c')
-rw-r--r--lib/xarray.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/xarray.c b/lib/xarray.c
index ae9d7fc68861..48f440d114e1 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -1410,9 +1410,11 @@ void *xas_find(struct xa_state *xas, unsigned long max)
entry = xas_load(xas);
if (entry || xas_not_node(xas->xa_node))
return entry;
- } else if (!xas->xa_node->shift &&
- xas->xa_offset != (xas->xa_index & XA_CHUNK_MASK)) {
- xas->xa_offset = ((xas->xa_index - 1) & XA_CHUNK_MASK) + 1;
+ } else if (xas->xa_offset != get_offset(xas->xa_index, xas->xa_node)) {
+ if (!xas->xa_node->shift)
+ xas->xa_offset = ((xas->xa_index - 1) & XA_CHUNK_MASK) + 1;
+ else
+ xas->xa_offset = get_offset(xas->xa_index, xas->xa_node);
}
xas_next_offset(xas);