[sheepdog] [PATCH] sheep: rename request->vnodes to request->vinfo

Yunkai Zhang yunkai.me at gmail.com
Sun Aug 5 07:43:57 CEST 2012


From: Yunkai Zhang <qiushu.zyk at taobao.com>

Note:
- this patch based on my two previous patches:
1) sheep: refactor oid_to_vnode[s] and cleanup obj_to_sheep[s]
2) sheep: refactor get_nth_node() and get_vnode_pos()
------------------------------------------------------ >8

The type of request->vnodes is vnode_info, let's
rename it to ->vinfo which will be more descriptive.

Signed-off-by: Yunkai Zhang <qiushu.zyk at taobao.com>
---
 sheep/gateway.c    |  8 ++++----
 sheep/ops.c        |  2 +-
 sheep/request.c    | 12 ++++++------
 sheep/sheep_priv.h |  2 +-
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/sheep/gateway.c b/sheep/gateway.c
index fe7ef2d..382dc7c 100644
--- a/sheep/gateway.c
+++ b/sheep/gateway.c
@@ -35,8 +35,8 @@ int gateway_read_obj(struct request *req)
 	if (sys->enable_write_cache && !req->local && !bypass_object_cache(req))
 		return object_cache_handle_request(req);
 
-	nr_copies = get_nr_copies(req->vnodes);
-	oid_to_vnodes(req->vnodes->vnodes, req->vnodes->nr_vnodes, oid,
+	nr_copies = get_nr_copies(req->vinfo);
+	oid_to_vnodes(req->vinfo->vnodes, req->vinfo->nr_vnodes, oid,
 		      nr_copies, obj_vnodes);
 	for (i = 0; i < nr_copies; i++) {
 		v = obj_vnodes[i];
@@ -245,8 +245,8 @@ static int gateway_forward_request(struct request *req)
 
 	write_info_init(&wi);
 	wlen = hdr.data_length;
-	nr_copies = get_nr_copies(req->vnodes);
-	oid_to_vnodes(req->vnodes->vnodes, req->vnodes->nr_vnodes, oid,
+	nr_copies = get_nr_copies(req->vinfo);
+	oid_to_vnodes(req->vinfo->vnodes, req->vinfo->nr_vnodes, oid,
 		      nr_copies, obj_vnodes);
 
 	for (i = 0; i < nr_copies; i++) {
diff --git a/sheep/ops.c b/sheep/ops.c
index 861d449..2210173 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -815,7 +815,7 @@ int peer_create_and_write_obj(struct request *req)
 			goto out;
 		}
 		if (hdr->data_length != SD_DATA_OBJ_SIZE) {
-			ret = read_copy_from_replica(req->vnodes, hdr->epoch,
+			ret = read_copy_from_replica(req->vinfo, hdr->epoch,
 						     hdr->obj.cow_oid, buf);
 			if (ret != SD_RES_SUCCESS) {
 				eprintf("failed to read cow object\n");
diff --git a/sheep/request.c b/sheep/request.c
index a673a63..ab7c63a 100644
--- a/sheep/request.c
+++ b/sheep/request.c
@@ -30,8 +30,8 @@ static int is_access_local(struct request *req, uint64_t oid)
 	int nr_copies;
 	int i;
 
-	nr_copies = get_nr_copies(req->vnodes);
-	oid_to_vnodes(req->vnodes->vnodes, req->vnodes->nr_vnodes, oid,
+	nr_copies = get_nr_copies(req->vinfo);
+	oid_to_vnodes(req->vinfo->vnodes, req->vinfo->nr_vnodes, oid,
 		      nr_copies, obj_vnodes);
 
 	for (i = 0; i < nr_copies; i++) {
@@ -365,7 +365,7 @@ static void queue_request(struct request *req)
 	 * called before we set up current_vnode_info
 	 */
 	if (!is_force_op(req->op))
-		req->vnodes = get_vnode_info();
+		req->vinfo = get_vnode_info();
 
 	if (is_peer_op(req->op)) {
 		queue_peer_request(req);
@@ -391,8 +391,8 @@ done:
 
 static void requeue_request(struct request *req)
 {
-	if (req->vnodes)
-		put_vnode_info(req->vnodes);
+	if (req->vinfo)
+		put_vnode_info(req->vinfo);
 	queue_request(req);
 }
 
@@ -479,7 +479,7 @@ static void free_request(struct request *req)
 	uatomic_dec(&sys->nr_outstanding_reqs);
 
 	req->ci->refcnt--;
-	put_vnode_info(req->vnodes);
+	put_vnode_info(req->vinfo);
 	free(req->data);
 	free(req);
 }
diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
index 201d322..54bce07 100644
--- a/sheep/sheep_priv.h
+++ b/sheep/sheep_priv.h
@@ -57,7 +57,7 @@ struct request {
 
 	uint64_t local_oid;
 
-	struct vnode_info *vnodes;
+	struct vnode_info *vinfo;
 
 	struct work work;
 };
-- 
1.7.11.2




More information about the sheepdog mailing list