[sheepdog] [PATCH v4 1/3] sheep: rework update node logic
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Wed Jul 10 11:07:32 CEST 2013
Sorry, one more comment I've noticed this time.
> @@ -343,6 +346,17 @@ static bool __corosync_dispatch_one(struct corosync_event *cevent)
> sd_notify_handler(&cevent->sender.ent, cevent->msg,
> cevent->msg_len);
> break;
> + case COROSYNC_EVENT_TYPE_UPDATE_NODE:
> + node = &cevent->sender.ent;
> +
> + if (node_eq(node, &this_node.ent))
> + this_node.ent = *node;
Using cpg_node_equal looks cleaner.
> diff --git a/sheep/cluster/local.c b/sheep/cluster/local.c
> index e6fa149..80228b3 100644
> --- a/sheep/cluster/local.c
> +++ b/sheep/cluster/local.c
> @@ -478,6 +478,10 @@ static bool local_process_event(void)
> sd_notify_handler(&ev->sender.node, ev->buf, ev->buf_len);
> break;
> case EVENT_UPDATE_NODE:
> + if (node_eq(&ev->sender.node, &this_node.node))
> + this_node.node = ev->sender.node;
Using lnode_eq looks cleaner.
> +static void zk_handle_update_node(struct zk_event *ev)
> +{
> + struct zk_node *t;
> + struct sd_node *snode = &ev->sender.node;
> +
> + sd_dprintf("%s", node_to_str(snode));
> +
> + if (node_eq(snode, &this_node.node))
> + this_node.node = *snode;
This is okay because we don't have zk_node_eq, but introducing
zk_node_cmp and zk_node_eq would improve code readability. It should
be in another patch in either way, though.
Thanks,
Kazutaka
More information about the sheepdog
mailing list