diff options
author | Matthew Wilcox <willy@infradead.org> | 2018-04-09 16:52:21 -0400 |
---|---|---|
committer | Matthew Wilcox <willy@infradead.org> | 2018-10-21 10:46:45 -0400 |
commit | adb9d9c4ccb1ff0bf1d376e65f36aa5573c75c1a (patch) | |
tree | 3d95a5cfd046858380eea28aba8042ba545067b1 /lib/test_xarray.c | |
parent | 8cf2f98411e3a0865026a1061af637161b16d32b (diff) |
radix tree: Remove radix_tree_clear_tags
The page cache was the only user of this interface and it has now
been converted to the XArray. Transform the test into a test of
xas_init_marks().
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to 'lib/test_xarray.c')
-rw-r--r-- | lib/test_xarray.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/test_xarray.c b/lib/test_xarray.c index 815daffdd8c9..ca86141641cb 100644 --- a/lib/test_xarray.c +++ b/lib/test_xarray.c | |||
@@ -213,12 +213,52 @@ static noinline void check_xa_mark_1(struct xarray *xa, unsigned long index) | |||
213 | XA_BUG_ON(xa, !xa_empty(xa)); | 213 | XA_BUG_ON(xa, !xa_empty(xa)); |
214 | } | 214 | } |
215 | 215 | ||
216 | static noinline void check_xa_mark_2(struct xarray *xa) | ||
217 | { | ||
218 | XA_STATE(xas, xa, 0); | ||
219 | unsigned long index; | ||
220 | unsigned int count = 0; | ||
221 | void *entry; | ||
222 | |||
223 | xa_store_index(xa, 0, GFP_KERNEL); | ||
224 | xa_set_mark(xa, 0, XA_MARK_0); | ||
225 | xas_lock(&xas); | ||
226 | xas_load(&xas); | ||
227 | xas_init_marks(&xas); | ||
228 | xas_unlock(&xas); | ||
229 | XA_BUG_ON(xa, !xa_get_mark(xa, 0, XA_MARK_0) == 0); | ||
230 | |||
231 | for (index = 3500; index < 4500; index++) { | ||
232 | xa_store_index(xa, index, GFP_KERNEL); | ||
233 | xa_set_mark(xa, index, XA_MARK_0); | ||
234 | } | ||
235 | |||
236 | xas_reset(&xas); | ||
237 | rcu_read_lock(); | ||
238 | xas_for_each_marked(&xas, entry, ULONG_MAX, XA_MARK_0) | ||
239 | count++; | ||
240 | rcu_read_unlock(); | ||
241 | XA_BUG_ON(xa, count != 1000); | ||
242 | |||
243 | xas_lock(&xas); | ||
244 | xas_for_each(&xas, entry, ULONG_MAX) { | ||
245 | xas_init_marks(&xas); | ||
246 | XA_BUG_ON(xa, !xa_get_mark(xa, xas.xa_index, XA_MARK_0)); | ||
247 | XA_BUG_ON(xa, !xas_get_mark(&xas, XA_MARK_0)); | ||
248 | } | ||
249 | xas_unlock(&xas); | ||
250 | |||
251 | xa_destroy(xa); | ||
252 | } | ||
253 | |||
216 | static noinline void check_xa_mark(struct xarray *xa) | 254 | static noinline void check_xa_mark(struct xarray *xa) |
217 | { | 255 | { |
218 | unsigned long index; | 256 | unsigned long index; |
219 | 257 | ||
220 | for (index = 0; index < 16384; index += 4) | 258 | for (index = 0; index < 16384; index += 4) |
221 | check_xa_mark_1(xa, index); | 259 | check_xa_mark_1(xa, index); |
260 | |||
261 | check_xa_mark_2(xa); | ||
222 | } | 262 | } |
223 | 263 | ||
224 | static noinline void check_xa_shrink(struct xarray *xa) | 264 | static noinline void check_xa_shrink(struct xarray *xa) |