[sheepdog] [PATCH 2/9] gateway: remove init_target_nodes
Liu Yuan
namei.unix at gmail.com
Thu Sep 19 12:42:46 CEST 2013
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
sheep/gateway.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/sheep/gateway.c b/sheep/gateway.c
index 1b0810b..016d69a 100644
--- a/sheep/gateway.c
+++ b/sheep/gateway.c
@@ -234,28 +234,16 @@ write_info_advance(struct write_info *wi, const struct node_id *nid,
wi->nr_sent++;
}
-static int init_target_nodes(struct request *req, uint64_t oid,
- const struct sd_node **target_nodes)
-{
- int nr_to_send;
- struct vnode_info *vinfo = req->vinfo;
-
- nr_to_send = get_req_copy_number(req);
- oid_to_nodes(oid, &vinfo->vroot, nr_to_send, target_nodes);
-
- return nr_to_send;
-}
-
static int gateway_forward_request(struct request *req)
{
int i, err_ret = SD_RES_SUCCESS, ret, local = -1;
unsigned wlen;
uint64_t oid = req->rq.obj.oid;
- int nr_to_send;
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);
sd_debug("%"PRIx64, oid);
@@ -263,10 +251,10 @@ static int gateway_forward_request(struct request *req)
op = get_sd_op(hdr.opcode);
wlen = hdr.data_length;
- nr_to_send = init_target_nodes(req, oid, target_nodes);
- write_info_init(&wi, nr_to_send);
+ oid_to_nodes(oid, &req->vinfo->vroot, nr_copies, target_nodes);
+ write_info_init(&wi, nr_copies);
- for (i = 0; i < nr_to_send; i++) {
+ for (i = 0; i < nr_copies; i++) {
struct sockfd *sfd;
const struct node_id *nid;
--
1.7.9.5
More information about the sheepdog
mailing list