[Sheepdog] [PATCH] sheep, sdnet: use is_myself() helper to check target node

Liu Yuan namei.unix at gmail.com
Wed Sep 28 09:34:44 CEST 2011


From: Liu Yuan <tailai.ly at taobao.com>


Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/sdnet.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index 94a8ae3..9985bdb 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -641,8 +641,7 @@ int write_object(struct sheepdog_vnode_list_entry *e,
 
 		n = obj_to_sheep(e, vnodes, oid, i);
 
-		if (memcmp(e[n].addr, sys->this_node.addr, sizeof(e[n].addr)) == 0 &&
-		    e[n].port == sys->this_node.port) {
+		if (is_myself(e[n].addr, e[n].port)) {
 			ret = write_object_local(oid, data, datalen, offset, nr,
 						 node_version, create);
 
@@ -704,8 +703,7 @@ int read_object(struct sheepdog_vnode_list_entry *e,
 	for (i = 0; i < nr; i++) {
 		n = obj_to_sheep(e, vnodes, oid, i);
 
-		if (memcmp(e[n].addr, sys->this_node.addr, sizeof(e[n].addr)) == 0 &&
-		    e[n].port == sys->this_node.port) {
+		if (is_myself(e[n].addr, e[n].port)) {
 			ret = read_object_local(oid, data, datalen, offset, nr,
 						node_version);
 
-- 
1.7.6.1




More information about the sheepdog mailing list