diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2020-03-31 14:23:59 -0400 |
---|---|---|
committer | Matthew Wilcox (Oracle) <willy@infradead.org> | 2020-10-07 09:11:33 -0400 |
commit | 062b735912b9f3aa3e14cd02b5ede08cf8bc093f (patch) | |
tree | 4bc56a35df9ffe304f552cfc7f882266f152a92e /lib/test_xarray.c | |
parent | a219b856a2b993da234108307be772448f22b0ce (diff) | |
download | lwn-062b735912b9f3aa3e14cd02b5ede08cf8bc093f.tar.gz lwn-062b735912b9f3aa3e14cd02b5ede08cf8bc093f.zip |
XArray: Test two more things about xa_cmpxchg
1. If we xa_cmpxchg() an entry in, it marks the index as not free.
2. If we xa_cmpxchg() NULL in, it marks the index as free.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Diffstat (limited to 'lib/test_xarray.c')
-rw-r--r-- | lib/test_xarray.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/test_xarray.c b/lib/test_xarray.c index d4f97925dbd8..9fc3da430aba 100644 --- a/lib/test_xarray.c +++ b/lib/test_xarray.c @@ -393,6 +393,9 @@ static noinline void check_cmpxchg(struct xarray *xa) XA_BUG_ON(xa, xa_cmpxchg(xa, 12345678, FIVE, LOTS, GFP_KERNEL) != FIVE); XA_BUG_ON(xa, xa_cmpxchg(xa, 5, FIVE, NULL, GFP_KERNEL) != NULL); XA_BUG_ON(xa, xa_cmpxchg(xa, 5, NULL, FIVE, GFP_KERNEL) != NULL); + XA_BUG_ON(xa, xa_insert(xa, 5, FIVE, GFP_KERNEL) != -EBUSY); + XA_BUG_ON(xa, xa_cmpxchg(xa, 5, FIVE, NULL, GFP_KERNEL) != FIVE); + XA_BUG_ON(xa, xa_insert(xa, 5, FIVE, GFP_KERNEL) == -EBUSY); xa_erase_index(xa, 12345678); xa_erase_index(xa, 5); XA_BUG_ON(xa, !xa_empty(xa)); |