[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200422150256.23473-22-jack@suse.cz>
Date: Wed, 22 Apr 2020 17:02:54 +0200
From: Jan Kara <jack@...e.cz>
To: Matthew Wilcox <willy@...radead.org>
Cc: <linux-fsdevel@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>, Jan Kara <jack@...e.cz>
Subject: [PATCH 21/23] testing: Introduce xa_erase_order() and use it
Introduce helper xa_erase_order() and call it from places that want to
erase entries from xarray instead of using xa_store_order(). This also
explicitely takes care of clearing possibly existing xarray marks
(although no current test seems to need it).
Signed-off-by: Jan Kara <jack@...e.cz>
---
lib/test_xarray.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/lib/test_xarray.c b/lib/test_xarray.c
index 2cf3ef5d5014..fc16eac1cbb9 100644
--- a/lib/test_xarray.c
+++ b/lib/test_xarray.c
@@ -83,6 +83,16 @@ static void *xa_store_order(struct xarray *xa, unsigned long index,
return curr;
}
+static void xa_erase_order(struct xarray *xa, unsigned long index,
+ unsigned order)
+{
+ XA_STATE_ORDER(xas, xa, index, order);
+
+ xas_lock(&xas);
+ xas_erase(&xas);
+ xas_unlock(&xas);
+}
+
static noinline void check_xa_err(struct xarray *xa)
{
XA_BUG_ON(xa, xa_err(xa_store_index(xa, 0, GFP_NOWAIT)) != 0);
@@ -608,13 +618,13 @@ static noinline void check_multi_store(struct xarray *xa)
rcu_read_unlock();
/* We can erase multiple values with a single store */
- xa_store_order(xa, 0, BITS_PER_LONG - 1, NULL, GFP_KERNEL);
+ xa_erase_order(xa, 0, BITS_PER_LONG - 1);
XA_BUG_ON(xa, !xa_empty(xa));
/* Even when the first slot is empty but the others aren't */
xa_store_index(xa, 1, GFP_KERNEL);
xa_store_index(xa, 2, GFP_KERNEL);
- xa_store_order(xa, 0, 2, NULL, GFP_KERNEL);
+ xa_erase_order(xa, 0, 2);
XA_BUG_ON(xa, !xa_empty(xa));
for (i = 0; i < max_order; i++) {
--
2.16.4
Powered by blists - more mailing lists