[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+CK2bDgfmwwNReGeCj18aYT-DUabYXugDdBAwQ3d02cCT7S+g@mail.gmail.com>
Date: Wed, 23 Oct 2024 13:24:31 -0400
From: Pasha Tatashin <pasha.tatashin@...een.com>
To: Suren Baghdasaryan <surenb@...gle.com>
Cc: akpm@...ux-foundation.org, kent.overstreet@...ux.dev, corbet@....net,
arnd@...db.de, mcgrof@...nel.org, rppt@...nel.org, paulmck@...nel.org,
thuth@...hat.com, tglx@...utronix.de, bp@...en8.de,
xiongwei.song@...driver.com, ardb@...nel.org, david@...hat.com,
vbabka@...e.cz, mhocko@...e.com, hannes@...xchg.org, roman.gushchin@...ux.dev,
dave@...olabs.net, willy@...radead.org, liam.howlett@...cle.com,
souravpanda@...gle.com, keescook@...omium.org, dennis@...nel.org,
jhubbard@...dia.com, urezki@...il.com, hch@...radead.org, petr.pavlu@...e.com,
samitolvanen@...gle.com, da.gomez@...sung.com, yuzhao@...gle.com,
vvvvvv@...gle.com, rostedt@...dmis.org, iamjoonsoo.kim@....com,
rientjes@...gle.com, minchan@...gle.com, kaleshsingh@...gle.com,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arch@...r.kernel.org, linux-mm@...ck.org,
maple-tree@...ts.infradead.org, linux-modules@...r.kernel.org,
kernel-team@...roid.com
Subject: Re: [PATCH v4 1/6] maple_tree: add mas_for_each_rev() helper
On Wed, Oct 23, 2024 at 1:08 PM Suren Baghdasaryan <surenb@...gle.com> wrote:
>
> Add mas_for_each_rev() function to iterate maple tree nodes in reverse
> order.
>
> Suggested-by: Liam R. Howlett <Liam.Howlett@...cle.com>
> Signed-off-by: Suren Baghdasaryan <surenb@...gle.com>
> Reviewed-by: Liam R. Howlett <Liam.Howlett@...cle.com>
Reviewed-by: Pasha Tatashin <pasha.tatashin@...een.com>
> ---
> include/linux/maple_tree.h | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h
> index 61c236850ca8..cbbcd18d4186 100644
> --- a/include/linux/maple_tree.h
> +++ b/include/linux/maple_tree.h
> @@ -592,6 +592,20 @@ static __always_inline void mas_reset(struct ma_state *mas)
> #define mas_for_each(__mas, __entry, __max) \
> while (((__entry) = mas_find((__mas), (__max))) != NULL)
>
> +/**
> + * mas_for_each_rev() - Iterate over a range of the maple tree in reverse order.
> + * @__mas: Maple Tree operation state (maple_state)
> + * @__entry: Entry retrieved from the tree
> + * @__min: minimum index to retrieve from the tree
> + *
> + * When returned, mas->index and mas->last will hold the entire range for the
> + * entry.
> + *
> + * Note: may return the zero entry.
> + */
> +#define mas_for_each_rev(__mas, __entry, __min) \
> + while (((__entry) = mas_find_rev((__mas), (__min))) != NULL)
> +
> #ifdef CONFIG_DEBUG_MAPLE_TREE
> enum mt_dump_format {
> mt_dump_dec,
> --
> 2.47.0.105.g07ac214952-goog
>
Powered by blists - more mailing lists