Re: [PATCH] rbtree: avoid generating code twice for the cached versions

From: Davidlohr Bueso
Date: Fri Jun 28 2019 - 12:56:53 EST


On Thu, 27 Jun 2019, Michel Lespinasse wrote:

As was already noted in rbtree.h, the logic to cache rb_first (or rb_last)
can easily be implemented externally to the core rbtree api.

Change the implementation to do just that. Previously the update of
rb_leftmost was wired deeper into the implemntation, but there were
some disadvantages to that - mostly, lib/rbtree.c had separate
instantiations for rb_insert_color() vs rb_insert_color_cached(), as well
as rb_erase() vs rb_erase_cached(), which were doing exactly the same
thing save for the rb_leftmost update at the start of either function.

I think this makes sense, and is more along the lines of the augmented
cached doing the static inline instead of separate instantiations of the
calls.

Change-Id: I0cb62be774fc0138b81188e6ae81d5f1da64578d
what is this?

Signed-off-by: Michel Lespinasse <walken@xxxxxxxxxx>

Acked-by: Davidlohr Bueso <dbueso@xxxxxxx>

Thanks!