[Sheepdog] [PATCH 2/8] sheep: set the number of replication properly

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Sat Aug 28 22:55:28 CEST 2010


Data redundancy cannot be larger than the number of nodes.

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

diff --git a/sheep/store.c b/sheep/store.c
index fe7600f..7ab7dfa 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -398,6 +398,8 @@ static int forward_read_obj_req(struct request *req)
 	/* temporary hack */
 	if (!copies)
 		copies = sys->nr_sobjs;
+	if (copies > req->nr_nodes)
+		copies = req->nr_nodes;
 
 	hdr->flags |= SD_FLAG_CMD_DIRECT;
 
@@ -462,6 +464,8 @@ static int forward_write_obj_req(struct request *req)
 	/* temporary hack */
 	if (!copies)
 		copies = sys->nr_sobjs;
+	if (copies > req->nr_nodes)
+		copies = req->nr_nodes;
 
 	nr_fds = 0;
 	done = 0;
-- 
1.5.6.5




More information about the sheepdog mailing list