At Mon, 5 Dec 2011 14:39:17 +0800, Liu Yuan wrote: > > From: Liu Yuan <tailai.ly at taobao.com> > > We should return error code up to hval_to_sheep() and let it panic out. There are other functions using get_nth_node(), and some of them doesn't expect that get_nth_node() returns a negative value (e.g. contains_node). The first and third patches in this series looks good to me, so I've applied them. Thanks, Kazutaka > > Signed-off-by: Liu Yuan <tailai.ly at taobao.com> > --- > include/sheep.h | 5 ++--- > 1 files changed, 2 insertions(+), 3 deletions(-) > > diff --git a/include/sheep.h b/include/sheep.h > index 662d5fc..d67845b 100644 > --- a/include/sheep.h > +++ b/include/sheep.h > @@ -15,6 +15,7 @@ > #include "util.h" > #include "list.h" > #include "net.h" > +#include "logger.h" > > #define SD_SHEEP_PROTO_VER 0x03 > > @@ -179,7 +180,6 @@ static inline int get_nth_node(struct sheepdog_vnode_list_entry *entries, > next: > idx = (idx + 1) % nr_entries; > if (idx == base) { > - abort(); > return -1; /* not found */ > } > for (i = 0; i < nr; i++) { > @@ -208,8 +208,7 @@ static inline int hval_to_sheep(struct sheepdog_vnode_list_entry *entries, > } > ret = get_nth_node(entries, nr_entries, (i + 1) % nr_entries, idx); > if (ret < 0) { > - printf("bug\n"); > - abort(); > + panic("bug\n"); > } > > return ret; > -- > 1.7.8.rc3 > > -- > sheepdog mailing list > sheepdog at lists.wpkg.org > http://lists.wpkg.org/mailman/listinfo/sheepdog |