[sheepdog] [PATCH] sheep: fix a bug of objects loss when some node has zone set to 0

levin li levin108 at gmail.com
Fri Aug 3 10:38:42 CEST 2012


From: levin li <xingke.lwp at taobao.com>

Before the patch 64233f7c16d6eafc5b981e5e5405923dfbd99b10 it's OK
to set zone to 0, because we skip the same node in get_nth_page(),
but after that patch, we just check same_zone() in get_nth_page(),
and same_zone() return false when zone of some node is 0, so there's
problem, it's reasonable for users to set zone to 0, so this patch
fixes this problem

Signed-off-by: levin li <xingke.lwp at taobao.com>
---
 include/sheep.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/sheep.h b/include/sheep.h
index 5795111..ef8dc22 100644
--- a/include/sheep.h
+++ b/include/sheep.h
@@ -57,7 +57,7 @@ static inline int same_node(struct sd_vnode *e, int n1, int n2)
 
 static inline int same_zone(struct sd_vnode *e, int n1, int n2)
 {
-	return e[n1].zone != 0 && e[n1].zone == e[n2].zone;
+	return e[n1].zone == e[n2].zone;
 }
 
 /* traverse the virtual node list and return the n'th one */
-- 
1.7.1




More information about the sheepdog mailing list