* Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> [230512 19:09]: > On Fri, 12 May 2023 14:20:29 -0400 "Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx> wrote: > > > Some users of the maple tree may want to move to the next range in the > > tree, even if it stores a NULL. This family of function provides that > > functionality by advancing one slot at a time and returning the result, > > while mas_contiguous() will iterate over the range and stop on > > encountering the first NULL. > > > > ... > > > > +/** > > + * mas_contiguous() - Iterate over a contiguous range of the maple tree. > > + * @__mas: Maple Tree operation state (maple_state) > > + * @__entry: Entry retrieved from the tree > > + * @__max: maximum index to retrieve from the tree > > + * > > + * When returned, mas->index and mas->last will hold the entire range of the > > + * entry. The loop will terminate on the first NULL encountered. > > + * > > + * Note: may return the zero entry. > > + */ > > +#define mas_contiguous(__mas, __entry, __max) \ > > + while (((__entry) = mas_find_range((__mas), (__max))) != NULL) > > > > I can's say I'm a fan of this. The name doesn't imply that this is a > looping construct. I can't say much more because mas_contiguous() has > no users.. I got a little ahead of myself with that. I will drop it. My hope is to introduce it to simplify the cases where users are iterating over VMAs and want them contiguous. I'll come up with a better name when I re-introduce it.