Re: [PATCH v4 06/11] rust: xarray: add `find_next` and `find_next_mut`
Andreas Hindborg <[email protected]>
| Newsgroups | org.kernel.vger.rust-for-linux,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
Tamir Duberstein <[email protected]> writes: > On Thu, 04 Jun 2026 21:58:12 +0200, Andreas Hindborg <[email protected]> wrote: >> Add methods to find the next element in an XArray starting from a >> given index. The methods return a tuple containing the index where the >> element was found and a reference to the element. >> >> The implementation uses the XArray state API via `xas_find` to avoid taking >> the rcu lock as an exclusive lock is already held by `Guard`. > > The previous patch re-hosts existing XArray methods on XArrayState, but > this patch and subsequent ones are choosing to grow the XArray API > rather than promote XArrayState to a proper abstraction that users > should prefer. Are you sure that's the right choice? We have the `Entry` API (introduced in patch 7) for users to interact with the XArray in a stateful manner. I think adding these public methods on `Guard` makes sense. Best regards, Andreas Hindborg