[Sheepdog] [PATCH 1/3] sheep: add helpers for message handling
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Tue Sep 27 08:10:14 CEST 2011
At Tue, 27 Sep 2011 13:57:05 +0800,
Liu Yuan wrote:
>
> On 09/27/2011 01:18 PM, MORITA Kazutaka wrote:
> > At Mon, 26 Sep 2011 18:57:23 +0800,
> > Liu Yuan wrote:
> >> From: Liu Yuan<tailai.ly at taobao.com>
> >>
> >>
> >> Signed-off-by: Liu Yuan<tailai.ly at taobao.com>
> >> ---
> >> sheep/group.c | 34 +++++++++++++++++++++++++++-------
> >> 1 files changed, 27 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/sheep/group.c b/sheep/group.c
> >> index 812f6a0..4bf275e 100644
> >> --- a/sheep/group.c
> >> +++ b/sheep/group.c
> >> @@ -142,6 +142,26 @@ CPG_EVENT_WORK_FNS(RUNNING, running)
> >> CPG_EVENT_WORK_FNS(SUSPENDED, suspended)
> >> CPG_EVENT_WORK_FNS(JOINING, joining)
> >>
> >> +static inline int join_message(struct message_header *m)
> >> +{
> >> + return m->op == SD_MSG_JOIN;
> >> +}
> >> +
> >> +static inline int vdi_op_message(struct message_header *m)
> >> +{
> >> + return m->op == SD_MSG_VDI_OP;
> >> +}
> >> +
> >> +static inline int master_chg_message(struct message_header *m)
> >> +{
> >> + return m->op == SD_MSG_MASTER_CHANGED;
> >> +}
> >> +
> >> +static inline int leave_message(struct message_header *m)
> >> +{
> >> + return m->op == SD_MSG_LEAVE;
> >> +}
> >> +
> > Are these helper functions really necessary? This patch looks a bit
> > odd to me. But if there is a reason for introducing those, I'm not
> > against it.
> >
> > Other than this, I think there is no problem. My testcase was
> > passed. :)
> >
>
> The main idea behind these helpers is to abstract away internal
> implementation of sheepdog message. For example, if we want to change
> these equation checks into bit operation when we consider necessary ,
> these helpers would be helpful. For other reason, I think sheepdog
> internal structure (both code flow and data structure )would need
> retrofits and I just try to do it a bit by bit.
Okay, make sense. I've applied these three patches.
I thought of creating a manual recovery command to fix an epoch
inconsistency, but your patches do the same thing in completely
automatic way. Really nice work!
Thanks,
Kazutaka
>
> Anyway, I am okay to drop these helpers.
>
> Thanks,
> Yuan
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog
More information about the sheepdog
mailing list