[<prev] [next>] [day] [month] [year] [list]
Message-ID: <720e32d8e185d5c82659bbdede05e87b3318c413.1769818406.git.ackerleytng@google.com>
Date: Fri, 30 Jan 2026 16:15:37 -0800
From: Ackerley Tng <ackerleytng@...gle.com>
To: willy@...radead.org, akpm@...ux-foundation.org,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Cc: david@...hat.com, michael.roth@....com, dev.jain@....com,
vannapurve@...gle.com, Ackerley Tng <ackerleytng@...gle.com>
Subject: [RFC PATCH v1 1/2] XArray tests: Fix check_split tests to store correctly
__xa_store() does not set up xas->xa_sibs, and when it calls xas_store(),
xas_store() stops prematurely and does not update node->nr_values to count
all values and siblings. Hence, when working with multi-index XArrays,
__xa_store() cannot be used.
Fix tests by calling xas_store() directly with xas->xa_sibs correctly set
up.
Signed-off-by: Ackerley Tng <ackerleytng@...gle.com>
---
lib/test_xarray.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/lib/test_xarray.c b/lib/test_xarray.c
index 5ca0aefee9aa..e71e8ff76900 100644
--- a/lib/test_xarray.c
+++ b/lib/test_xarray.c
@@ -1846,8 +1846,14 @@ static void check_split_1(struct xarray *xa, unsigned long index,
xas_split_alloc(&xas, xa, order, GFP_KERNEL);
xas_lock(&xas);
xas_split(&xas, xa, order);
- for (i = 0; i < (1 << order); i += (1 << new_order))
- __xa_store(xa, index + i, xa_mk_index(index + i), 0);
+ for (i = 0; i < (1 << order); i += (1 << new_order)) {
+ xas_set_order(&xas, index + i, new_order);
+ /*
+ * Don't worry about -ENOMEM, xas_split_alloc() and
+ * xas_split() ensures that all nodes are allocated.
+ */
+ xas_store(&xas, xa_mk_index(index + i));
+ }
xas_unlock(&xas);
for (i = 0; i < (1 << order); i++) {
@@ -1893,8 +1899,14 @@ static void check_split_2(struct xarray *xa, unsigned long index,
xas_unlock(&xas);
goto out;
}
- for (i = 0; i < (1 << order); i += (1 << new_order))
- __xa_store(xa, index + i, xa_mk_index(index + i), 0);
+ for (i = 0; i < (1 << order); i += (1 << new_order)) {
+ xas_set_order(&xas, index + i, new_order);
+ /*
+ * Don't worry about -ENOMEM, xas_split_alloc() and
+ * xas_split() ensures that all nodes are allocated.
+ */
+ xas_store(&xas, xa_mk_index(index + i));
+ }
xas_unlock(&xas);
for (i = 0; i < (1 << order); i++) {
--
2.53.0.rc1.225.gd81095ad13-goog
Powered by blists - more mailing lists