summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@infradead.org>2018-11-05 15:48:49 -0500
committerMatthew Wilcox <willy@infradead.org>2018-11-05 16:38:09 -0500
commit9c16bb88905456a9b1299338041f05fa7699971b (patch)
tree9396efce15dc79286b590c5740397f7f2bcc13c1 /lib
parentc5beb07e7a06b24f4f27304f6282b5dbd929543b (diff)
XArray: Turn xa_erase into an exported function
Make xa_erase() take the spinlock and then call __xa_erase(), but make it out of line since it's such a common function. Signed-off-by: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/xarray.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/xarray.c b/lib/xarray.c
index 77671d4a7910..b55aa8c1c20f 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -1337,6 +1337,30 @@ void *__xa_erase(struct xarray *xa, unsigned long index)
1337EXPORT_SYMBOL(__xa_erase); 1337EXPORT_SYMBOL(__xa_erase);
1338 1338
1339/** 1339/**
1340 * xa_erase() - Erase this entry from the XArray.
1341 * @xa: XArray.
1342 * @index: Index of entry.
1343 *
1344 * This function is the equivalent of calling xa_store() with %NULL as
1345 * the third argument. The XArray does not need to allocate memory, so
1346 * the user does not need to provide GFP flags.
1347 *
1348 * Context: Any context. Takes and releases the xa_lock.
1349 * Return: The entry which used to be at this index.
1350 */
1351void *xa_erase(struct xarray *xa, unsigned long index)
1352{
1353 void *entry;
1354
1355 xa_lock(xa);
1356 entry = __xa_erase(xa, index);
1357 xa_unlock(xa);
1358
1359 return entry;
1360}
1361EXPORT_SYMBOL(xa_erase);
1362
1363/**
1340 * xa_store() - Store this entry in the XArray. 1364 * xa_store() - Store this entry in the XArray.
1341 * @xa: XArray. 1365 * @xa: XArray.
1342 * @index: Index into array. 1366 * @index: Index into array.