[PATCH 03/23] xarray: Use xas_store_noinit() in __xa_store, __xa_insert, __xa_alloc

From: Jan Kara
Date: Wed Apr 22 2020 - 11:06:18 EST


These three functions never store NULL in the array so xas_store() is
equivalent to xas_store_noinit(). Replace it.

Signed-off-by: Jan Kara <jack@xxxxxxx>
---
lib/xarray.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/xarray.c b/lib/xarray.c
index ed98fc152b17..2eb634e8bf15 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -1079,7 +1079,7 @@ EXPORT_SYMBOL_GPL(__xas_next);
*
* If no entry is found and the array is smaller than @max, the iterator
* is set to the smallest index not yet in the array. This allows @xas
- * to be immediately passed to xas_store().
+ * to be immediately passed to xas_store_noinit().
*
* Return: The entry, if found, otherwise %NULL.
*/
@@ -1145,7 +1145,7 @@ EXPORT_SYMBOL_GPL(xas_find);
* If no marked entry is found and the array is smaller than @max, @xas is
* set to the bounds state and xas->xa_index is set to the smallest index
* not yet in the array. This allows @xas to be immediately passed to
- * xas_store().
+ * xas_store_noinit().
*
* If no entry is found before @max is reached, @xas is set to the restart
* state.
@@ -1412,7 +1412,7 @@ void *__xa_store(struct xarray *xa, unsigned long index, void *entry, gfp_t gfp)
entry = XA_ZERO_ENTRY;

do {
- curr = xas_store(&xas, entry);
+ curr = xas_store_noinit(&xas, entry);
if (xa_track_free(xa))
xas_clear_mark(&xas, XA_FREE_MARK);
} while (__xas_nomem(&xas, gfp));
@@ -1517,7 +1517,7 @@ int __xa_insert(struct xarray *xa, unsigned long index, void *entry, gfp_t gfp)
do {
curr = xas_load(&xas);
if (!curr) {
- xas_store(&xas, entry);
+ xas_store_noinit(&xas, entry);
if (xa_track_free(xa))
xas_clear_mark(&xas, XA_FREE_MARK);
} else {
@@ -1653,7 +1653,7 @@ int __xa_alloc(struct xarray *xa, u32 *id, void *entry,
xas_set_err(&xas, -EBUSY);
else
*id = xas.xa_index;
- xas_store(&xas, entry);
+ xas_store_noinit(&xas, entry);
xas_clear_mark(&xas, XA_FREE_MARK);
} while (__xas_nomem(&xas, gfp));

--
2.16.4