On Tue, Jan 15, 2019 at 02:42:50PM -0700, Jason Gunthorpe wrote: > On Tue, Jan 15, 2019 at 01:22:43PM -0800, Matthew Wilcox wrote: > > On Tue, Jan 15, 2019 at 02:15:41PM -0700, Jason Gunthorpe wrote: > > > Matt, down the road can we get an xa_alloc_cyclic helper that handles > > > this and the required locking? I have another need in the works as > > > well.. > > > > http://git.infradead.org/users/willy/linux-dax.git/shortlog/refs/heads/xarray-conv > > > > all current users of idr_alloc_cyclic are converted to xa_alloc_cyclic() > > in that tree. > > Maybe this is what your commit comment was talking about: > > int __xa_alloc_cyclic(struct xarray *xa, u32 *id, void *entry, > const struct xa_limit *limit, u32 *next, gfp_t gfp) > { > XA_LIMIT(tmp, *next, limit->max); > > I would have expected to be: > > XA_LIMIT(tmp, min(limit->min, *next), limit->max); > > I think it is a very surprising API design that the limit is not > respected in all cases. > > Since going below the limit also disables the 'cyclic' part of this > function, why shouldn't callers have to use straight xa_alloc (or > __xa_alloc if they need atomic next updates)?? > > ... Leon, Matt's version is shorter than yours maybe just include it > as a static in your module and we can replace it when Matt's is > merged? I don't like his double call to xa_alloc(), but it is not super-important in our case, I will add this function to make conversion easy. Thanks > > Jason
Attachment:
signature.asc
Description: PGP signature