[sheepdog] [PATCH v2 03/11] gateway: remove shortcut for local node in gateway_forward_request

Liu Yuan namei.unix at gmail.com
Thu Sep 26 09:25:40 CEST 2013


Shortcut forward-reqeust to local node doesn't improve performance a lot because
we forward the requests to many nodes concurrently and wait for all the
responses of all the requests, slowest one determine the how long we take for
this request.

Removing the shortcut for local node doesn't reduce the performance but result
in a more simplifed code.

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 sheep/gateway.c |   20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/sheep/gateway.c b/sheep/gateway.c
index 1b0bf6f..8377c89 100644
--- a/sheep/gateway.c
+++ b/sheep/gateway.c
@@ -228,11 +228,10 @@ write_info_advance(struct write_info *wi, const struct node_id *nid,
 
 static int gateway_forward_request(struct request *req)
 {
-	int i, err_ret = SD_RES_SUCCESS, ret, local = -1;
+	int i, err_ret = SD_RES_SUCCESS, ret;
 	unsigned wlen;
 	uint64_t oid = req->rq.obj.oid;
 	struct write_info wi;
-	const struct sd_op_template *op;
 	struct sd_req hdr;
 	const struct sd_node *target_nodes[SD_MAX_NODES];
 	int nr_copies = get_req_copy_number(req);
@@ -240,7 +239,6 @@ static int gateway_forward_request(struct request *req)
 	sd_debug("%"PRIx64, oid);
 
 	gateway_init_fwd_hdr(&hdr, &req->rq);
-	op = get_sd_op(hdr.opcode);
 
 	wlen = hdr.data_length;
 	oid_to_nodes(oid, &req->vinfo->vroot, nr_copies, target_nodes);
@@ -250,11 +248,6 @@ static int gateway_forward_request(struct request *req)
 		struct sockfd *sfd;
 		const struct node_id *nid;
 
-		if (node_is_local(target_nodes[i])) {
-			local = i;
-			continue;
-		}
-
 		nid = &target_nodes[i]->nid;
 		sfd = sockfd_cache_get(nid);
 		if (!sfd) {
@@ -274,17 +267,6 @@ static int gateway_forward_request(struct request *req)
 		write_info_advance(&wi, nid, sfd);
 	}
 
-	if (local != -1 && err_ret == SD_RES_SUCCESS) {
-		assert(op);
-		ret = sheep_do_op_work(op, req);
-
-		if (ret != SD_RES_SUCCESS) {
-			sd_err("fail to write local %"PRIx64", %s", oid,
-			       sd_strerror(ret));
-			err_ret = ret;
-		}
-	}
-
 	sd_debug("nr_sent %d, err %x", wi.nr_sent, err_ret);
 	if (wi.nr_sent > 0) {
 		ret = wait_forward_request(&wi, req);
-- 
1.7.9.5




More information about the sheepdog mailing list