Subject: Re: [PATCH RFC v2 10/21] net: rbridge: add rbr_node management function

From: Sergei Shtylyov <[email-masked]>
Date: Tue, 1 Sep 2015 21:30:49 +0300

On 09/01/2015 06:43 PM, Ahmed Amamou wrote:

> rbr_node are used to save distant Rbridges information
> they are use by local Rbridge to take routing decision
> this patch add get/put/free/find/del  function to rbr_node to
> avoid freeing a rbr_node that is still in use for routing
>
> Signed-off-by: Ahmed Amamou <[email-masked]>
> Signed-off-by: Kamel Haddadou <[email-masked]>
> Signed-off-by: William Dauchy <[email-masked]>
> ---
>   net/bridge/rbr.c         | 35 +++++++++++++++++++++++++++++++++++
>   net/bridge/rbr_private.h | 23 +++++++++++++++++++++++
>   2 files changed, 58 insertions(+)

[...]
> diff --git a/net/bridge/rbr_private.h b/net/bridge/rbr_private.h
> index 9166a8b..186e454 100644
> --- a/net/bridge/rbr_private.h
> +++ b/net/bridge/rbr_private.h
> @@ -44,7 +44,30 @@ struct rbr {
[...]
> +static inline void rbr_node_put(struct rbr_node *rbr_node)
> +{
> +	if (rbr_node) {
> +		if (unlikely(atomic_dec_and_test(&rbr_node->refs)))

    Could fold both 'if's into one and avoid {} altogether.

> +			rbr_node_free(rbr_node);
> +	}
> +}
> +

MBR, Sergei