mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
76b4e52995
commit
b0606fed6e
4 changed files with 126 additions and 48 deletions
|
@ -382,10 +382,12 @@ static noinline void check_reserve(struct xarray *xa)
|
|||
xa_erase_index(xa, 12345678);
|
||||
XA_BUG_ON(xa, !xa_empty(xa));
|
||||
|
||||
/* And so does xa_insert */
|
||||
/* But xa_insert does not */
|
||||
xa_reserve(xa, 12345678, GFP_KERNEL);
|
||||
XA_BUG_ON(xa, xa_insert(xa, 12345678, xa_mk_value(12345678), 0) != 0);
|
||||
xa_erase_index(xa, 12345678);
|
||||
XA_BUG_ON(xa, xa_insert(xa, 12345678, xa_mk_value(12345678), 0) !=
|
||||
-EEXIST);
|
||||
XA_BUG_ON(xa, xa_empty(xa));
|
||||
XA_BUG_ON(xa, xa_erase(xa, 12345678) != NULL);
|
||||
XA_BUG_ON(xa, !xa_empty(xa));
|
||||
|
||||
/* Can iterate through a reserved entry */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue