On Fri, Apr 20, 2018 at 07:00:47AM -0500, Goldwyn Rodrigues wrote: > > +/** > > + * xas_for_each_tag() - Iterate over a range of an XArray > > + * @xas: XArray operation state. > > + * @entry: Entry retrieved from array. > > + * @max: Maximum index to retrieve from array. > > + * @tag: Tag to search for. > > + * > > + * The loop body will be executed for each tagged entry in the xarray > > + * between the current xas position and @max. @entry will be set to > > + * the entry retrieved from the xarray. It is safe to delete entries > > + * from the array in the loop body. You should hold either the RCU lock > > + * or the xa_lock while iterating. If you need to drop the lock, call > > + * xas_pause() first. > > + */ > > +#define xas_for_each_tag(xas, entry, max, tag) \ > > + for (entry = xas_find_tag(xas, max, tag); entry; \ > > + entry = xas_next_tag(xas, max, tag)) > > + > > This function name sounds like you are performing the operation for each > tag. > > Can it be called xas_for_each_tagged() or xas_tag_for_each() instead? I hadn't thought of that interpretation. Yes, that makes sense. Should we also rename xas_find_tag -> xas_find_tagged and xas_next_tag -> xas_next_tagged?