[Sheepdog] [PATCH 2/5] sheep: remove redundant requests

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Jan 27 13:47:39 CET 2011


The number of replicaton is at most the number of nodes.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/sdnet.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index 5fff8ed..4cfa6df 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -583,6 +583,9 @@ int write_object(struct sheepdog_node_list_entry *e,
 	int i, n, fd, ret, success = 0;
 	char name[128];
 
+	if (nr > nodes)
+		nr = nodes;
+
 	for (i = 0; i < nr; i++) {
 		unsigned rlen = 0, wlen = datalen;
 
@@ -631,6 +634,9 @@ int read_object(struct sheepdog_node_list_entry *e,
 	char name[128];
 	int i = 0, n, fd, ret;
 
+	if (nr > nodes)
+		nr = nodes;
+
 	for (i = 0; i < nr; i++) {
 		unsigned wlen = 0, rlen = datalen;
 
-- 
1.5.6.5




More information about the sheepdog mailing list