XArray updates for 4.20-rc7
Two bugfixes, each with test-suite updates, two improvements to the test-suite without associated bugs, and one patch adding a missing API. -----BEGIN PGP SIGNATURE----- iQFIBAABCgAyFiEEejHryeLBw/spnjHrDpNsjXcpgj4FAlwS8ZUUHHdpbGx5QGlu ZnJhZGVhZC5vcmcACgkQDpNsjXcpgj5h0wf9Fmc3z3WjmX05he+XKhGq1jQuHYVi zt8Eggsc7ns1hX8xPdwSw240CDOCBcbXxCyNL9KFCqlIkfxTAe8pYgoTDKuXhVAK U7VTCHCxJpsYzfhkEke5DaASGb/YP1kmvoTJs7qCfhBuI9ERXLVK6cESJNDZhlMA /d7VfRwRiqSLnK13AXPZAA9Pnw2GtAolMDU9CC9nOtMRlRDVwsQiwYiQ/mBRYK00 u0LoruwBJ7XAoe7Bo1CFmkvJuIV794cmhqkEY2cY85e9aoj15+BDqOu1la8DTaOl e7+7PwK1I6Ed6DfPixGleUP7BYHHXCfb/RVEYn22qGC/YHUQRtpbwrY37Q== =b+pK -----END PGP SIGNATURE----- Merge tag 'xarray-4.20-rc7' of git://git.infradead.org/users/willy/linux-dax Pull XArray fixes from Matthew Wilcox: "Two bugfixes, each with test-suite updates, two improvements to the test-suite without associated bugs, and one patch adding a missing API" * tag 'xarray-4.20-rc7' of git://git.infradead.org/users/willy/linux-dax: XArray: Fix xa_alloc when id exceeds max XArray tests: Check iterating over multiorder entries XArray tests: Handle larger indices more elegantly XArray: Add xa_cmpxchg_irq and xa_cmpxchg_bh radix tree: Don't return retry entries from lookup
This commit is contained in:
commit
880b9df1bf
10 changed files with 258 additions and 54 deletions
|
|
@ -553,6 +553,60 @@ static inline void *xa_cmpxchg(struct xarray *xa, unsigned long index,
|
|||
return curr;
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_cmpxchg_bh() - Conditionally replace an entry in the XArray.
|
||||
* @xa: XArray.
|
||||
* @index: Index into array.
|
||||
* @old: Old value to test against.
|
||||
* @entry: New value to place in array.
|
||||
* @gfp: Memory allocation flags.
|
||||
*
|
||||
* This function is like calling xa_cmpxchg() except it disables softirqs
|
||||
* while holding the array lock.
|
||||
*
|
||||
* Context: Any context. Takes and releases the xa_lock while
|
||||
* disabling softirqs. May sleep if the @gfp flags permit.
|
||||
* Return: The old value at this index or xa_err() if an error happened.
|
||||
*/
|
||||
static inline void *xa_cmpxchg_bh(struct xarray *xa, unsigned long index,
|
||||
void *old, void *entry, gfp_t gfp)
|
||||
{
|
||||
void *curr;
|
||||
|
||||
xa_lock_bh(xa);
|
||||
curr = __xa_cmpxchg(xa, index, old, entry, gfp);
|
||||
xa_unlock_bh(xa);
|
||||
|
||||
return curr;
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_cmpxchg_irq() - Conditionally replace an entry in the XArray.
|
||||
* @xa: XArray.
|
||||
* @index: Index into array.
|
||||
* @old: Old value to test against.
|
||||
* @entry: New value to place in array.
|
||||
* @gfp: Memory allocation flags.
|
||||
*
|
||||
* This function is like calling xa_cmpxchg() except it disables interrupts
|
||||
* while holding the array lock.
|
||||
*
|
||||
* Context: Process context. Takes and releases the xa_lock while
|
||||
* disabling interrupts. May sleep if the @gfp flags permit.
|
||||
* Return: The old value at this index or xa_err() if an error happened.
|
||||
*/
|
||||
static inline void *xa_cmpxchg_irq(struct xarray *xa, unsigned long index,
|
||||
void *old, void *entry, gfp_t gfp)
|
||||
{
|
||||
void *curr;
|
||||
|
||||
xa_lock_irq(xa);
|
||||
curr = __xa_cmpxchg(xa, index, old, entry, gfp);
|
||||
xa_unlock_irq(xa);
|
||||
|
||||
return curr;
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_insert() - Store this entry in the XArray unless another entry is
|
||||
* already present.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue