diff options
Diffstat (limited to 'lib/xarray.c')
-rw-r--r-- | lib/xarray.c | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/lib/xarray.c b/lib/xarray.c index 9cab8cfef8a8..77671d4a7910 100644 --- a/lib/xarray.c +++ b/lib/xarray.c | |||
@@ -1407,47 +1407,6 @@ void *__xa_store(struct xarray *xa, unsigned long index, void *entry, gfp_t gfp) | |||
1407 | EXPORT_SYMBOL(__xa_store); | 1407 | EXPORT_SYMBOL(__xa_store); |
1408 | 1408 | ||
1409 | /** | 1409 | /** |
1410 | * xa_cmpxchg() - Conditionally replace an entry in the XArray. | ||
1411 | * @xa: XArray. | ||
1412 | * @index: Index into array. | ||
1413 | * @old: Old value to test against. | ||
1414 | * @entry: New value to place in array. | ||
1415 | * @gfp: Memory allocation flags. | ||
1416 | * | ||
1417 | * If the entry at @index is the same as @old, replace it with @entry. | ||
1418 | * If the return value is equal to @old, then the exchange was successful. | ||
1419 | * | ||
1420 | * Context: Process context. Takes and releases the xa_lock. May sleep | ||
1421 | * if the @gfp flags permit. | ||
1422 | * Return: The old value at this index or xa_err() if an error happened. | ||
1423 | */ | ||
1424 | void *xa_cmpxchg(struct xarray *xa, unsigned long index, | ||
1425 | void *old, void *entry, gfp_t gfp) | ||
1426 | { | ||
1427 | XA_STATE(xas, xa, index); | ||
1428 | void *curr; | ||
1429 | |||
1430 | if (WARN_ON_ONCE(xa_is_internal(entry))) | ||
1431 | return XA_ERROR(-EINVAL); | ||
1432 | |||
1433 | do { | ||
1434 | xas_lock(&xas); | ||
1435 | curr = xas_load(&xas); | ||
1436 | if (curr == XA_ZERO_ENTRY) | ||
1437 | curr = NULL; | ||
1438 | if (curr == old) { | ||
1439 | xas_store(&xas, entry); | ||
1440 | if (xa_track_free(xa) && entry) | ||
1441 | xas_clear_mark(&xas, XA_FREE_MARK); | ||
1442 | } | ||
1443 | xas_unlock(&xas); | ||
1444 | } while (xas_nomem(&xas, gfp)); | ||
1445 | |||
1446 | return xas_result(&xas, curr); | ||
1447 | } | ||
1448 | EXPORT_SYMBOL(xa_cmpxchg); | ||
1449 | |||
1450 | /** | ||
1451 | * __xa_cmpxchg() - Store this entry in the XArray. | 1410 | * __xa_cmpxchg() - Store this entry in the XArray. |
1452 | * @xa: XArray. | 1411 | * @xa: XArray. |
1453 | * @index: Index into array. | 1412 | * @index: Index into array. |