[sheepdog] [PATCH v4 1/3] sheep: rework update node logic

Liu Yuan namei.unix at gmail.com
Wed Jul 10 11:58:45 CEST 2013


On Wed, Jul 10, 2013 at 06:07:32PM +0900, MORITA Kazutaka wrote:
> 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.

We have to init cpg_node to use cpg_node_equal, it is tedious.

> 
> > 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.

ditto.

Thanks
Yuan



More information about the sheepdog mailing list