[sheepdog] [PATCH] sheep: initialize only used write_info

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon Oct 22 05:58:37 CEST 2012


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

diff --git a/sheep/gateway.c b/sheep/gateway.c
index 2c0cb89..2bd6e78 100644
--- a/sheep/gateway.c
+++ b/sheep/gateway.c
@@ -208,10 +208,10 @@ finish_write:
 	return err_ret;
 }
 
-static inline void write_info_init(struct write_info *wi)
+static inline void write_info_init(struct write_info *wi, size_t nr_to_send)
 {
 	int i;
-	for (i = 0; i < SD_MAX_NODES; i++)
+	for (i = 0; i < nr_to_send; i++)
 		wi->ent[i].pfd.fd = -1;
 	wi->nr_sent = 0;
 }
@@ -264,9 +264,9 @@ static int gateway_forward_request(struct request *req, bool all_node)
 	gateway_init_fwd_hdr(&hdr, &req->rq);
 	op = get_sd_op(hdr.opcode);
 
-	write_info_init(&wi);
 	wlen = hdr.data_length;
 	nr_to_send = init_target_nodes(req, all_node, oid, target_nodes);
+	write_info_init(&wi, nr_to_send);
 
 	for (i = 0; i < nr_to_send; i++) {
 		struct sockfd *sfd;
-- 
1.7.2.5




More information about the sheepdog mailing list