diff options
author | Matthew Wilcox <willy@infradead.org> | 2019-01-02 13:57:03 -0500 |
---|---|---|
committer | Matthew Wilcox <willy@infradead.org> | 2019-01-06 22:12:58 -0500 |
commit | b0606fed6eece16a421034eca0bbea9a08b90e91 (patch) | |
tree | f705b58760a60fce2d6f03a934a5038154505c1b /lib/test_xarray.c | |
parent | 76b4e52995654af260f14558e0e07b5b039ae202 (diff) |
XArray: Honour reserved entries in xa_insert
xa_insert() should treat reserved entries as occupied, not as available.
Also, it should treat requests to insert a NULL pointer as a request
to reserve the slot. Add xa_insert_bh() and xa_insert_irq() for
completeness.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to 'lib/test_xarray.c')
-rw-r--r-- | lib/test_xarray.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/test_xarray.c b/lib/test_xarray.c index 6e0212a60b08..3cf17338b0a4 100644 --- a/lib/test_xarray.c +++ b/lib/test_xarray.c | |||
@@ -382,10 +382,12 @@ static noinline void check_reserve(struct xarray *xa) | |||
382 | xa_erase_index(xa, 12345678); | 382 | xa_erase_index(xa, 12345678); |
383 | XA_BUG_ON(xa, !xa_empty(xa)); | 383 | XA_BUG_ON(xa, !xa_empty(xa)); |
384 | 384 | ||
385 | /* And so does xa_insert */ | 385 | /* But xa_insert does not */ |
386 | xa_reserve(xa, 12345678, GFP_KERNEL); | 386 | xa_reserve(xa, 12345678, GFP_KERNEL); |
387 | XA_BUG_ON(xa, xa_insert(xa, 12345678, xa_mk_value(12345678), 0) != 0); | 387 | XA_BUG_ON(xa, xa_insert(xa, 12345678, xa_mk_value(12345678), 0) != |
388 | xa_erase_index(xa, 12345678); | 388 | -EEXIST); |
389 | XA_BUG_ON(xa, xa_empty(xa)); | ||
390 | XA_BUG_ON(xa, xa_erase(xa, 12345678) != NULL); | ||
389 | XA_BUG_ON(xa, !xa_empty(xa)); | 391 | XA_BUG_ON(xa, !xa_empty(xa)); |
390 | 392 | ||
391 | /* Can iterate through a reserved entry */ | 393 | /* Can iterate through a reserved entry */ |