Re: [PATCH 4/6] Xarray: skip unneeded xas_store() and xas_clear_mark() in __xa_alloc()
From: Matthew Wilcox
Date: Fri Nov 01 2024 - 12:03:00 EST
On Fri, Nov 01, 2024 at 11:50:26PM +0800, Kemeng Shi wrote:
> If xas_find_marked() failed, there is no need to call xas_store() and
> xas_clear_mark(). Just call xas_store() and xas_clear_mark() if
> xas_find_marked() succeed.
No. The point of the xas interfaces is that they turn into no-ops once
an error has occurred.
> - else
> + else {
> *id = xas.xa_index;
> - xas_store(&xas, entry);
> - xas_clear_mark(&xas, XA_FREE_MARK);
> + xas_store(&xas, entry);
> + xas_clear_mark(&xas, XA_FREE_MARK);
> + }
> } while (__xas_nomem(&xas, gfp));
>
> return xas_error(&xas);
> --
> 2.30.0
>