[Sheepdog] [PATCH] sheep: call req_done directly

Christoph Hellwig hch at infradead.org
Tue May 15 10:53:09 CEST 2012


Signed-off-by: Christoph Hellwig <hch at lst.de>

---
 sheep/group.c      |    2 +-
 sheep/sdnet.c      |   16 ++++++----------
 sheep/sheep_priv.h |    5 ++---
 3 files changed, 9 insertions(+), 14 deletions(-)

Index: sheepdog/sheep/group.c
===================================================================
--- sheepdog.orig/sheep/group.c	2012-05-15 10:32:38.607973725 +0200
+++ sheepdog/sheep/group.c	2012-05-15 10:34:54.351972431 +0200
@@ -638,7 +638,7 @@ static void __sd_notify_done(struct even
 	if (has_process_main(req->op))
 		memcpy(req->data, msg->data, msg->rsp.data_length);
 	memcpy(&req->rp, &msg->rsp, sizeof(req->rp));
-	req->done(req);
+	req_done(req);
 }
 
 void sd_notify_handler(struct sd_node *sender, void *msg, size_t msg_len)
Index: sheepdog/sheep/sdnet.c
===================================================================
--- sheepdog.orig/sheep/sdnet.c	2012-05-15 10:32:38.607973725 +0200
+++ sheepdog/sheep/sdnet.c	2012-05-15 10:34:54.355972432 +0200
@@ -129,7 +129,7 @@ static void io_op_done(struct work *work
 	resume_pending_requests();
 	resume_recovery_work();
 
-	req->done(req);
+	req_done(req);
 	return;
 
 retry:
@@ -153,7 +153,7 @@ static void local_op_done(struct work *w
 						 &req->rp, req->data);
 	}
 
-	req->done(req);
+	req_done(req);
 }
 
 static void cluster_op_done(struct work *work)
@@ -266,8 +266,7 @@ static void queue_request(struct request
 	if (!req->op) {
 		eprintf("invalid opcode %d\n", hdr->opcode);
 		rsp->result = SD_RES_INVALID_PARMS;
-		req->done(req);
-		return;
+		goto done;
 	}
 
 	dprintf("%x\n", hdr->opcode);
@@ -329,8 +328,7 @@ static void queue_request(struct request
 	} else {
 		eprintf("unknown operation %d\n", hdr->opcode);
 		rsp->result = SD_RES_SYSTEM_ERROR;
-		req->done(req);
-		return;
+		goto done;
 	}
 
 	list_add_tail(&req->request_list, &sys->request_queue);
@@ -338,7 +336,7 @@ static void queue_request(struct request
 	process_request_event_queues();
 	return;
 done:
-	req->done(req);
+	req_done(req);
 }
 
 static void client_incref(struct client_info *ci);
@@ -381,7 +379,7 @@ static void free_request(struct request
 	free(req);
 }
 
-static void req_done(struct request *req)
+void req_done(struct request *req)
 {
 	struct client_info *ci = req->ci;
 
@@ -470,8 +468,6 @@ static void client_rx_handler(struct cli
 	else
 		req->rp.data_length = hdr->data_length;
 
-	req->done = req_done;
-
 	dprintf("connection from: %s:%d\n", ci->conn.ipstr, ci->conn.port);
 	queue_request(req);
 }
Index: sheepdog/sheep/sheep_priv.h
===================================================================
--- sheepdog.orig/sheep/sheep_priv.h	2012-05-15 10:32:38.607973725 +0200
+++ sheepdog/sheep/sheep_priv.h	2012-05-15 10:34:54.355972432 +0200
@@ -63,8 +63,6 @@ struct client_info {
 struct request;
 struct vnode_info;
 
-typedef void (*req_end_t) (struct request *);
-
 struct request {
 	struct sd_req rq;
 	struct sd_rsp rp;
@@ -84,7 +82,6 @@ struct request {
 	struct vnode_info *vnodes;
 	int check_consistency;
 
-	req_end_t done;
 	struct work work;
 };
 
@@ -312,6 +309,8 @@ int init_objlist_cache(void);
 int objlist_cache_rb_remove(struct rb_root *root, uint64_t oid);
 int check_and_insert_objlist_cache(uint64_t oid);
 
+void req_done(struct request *req);
+
 /* Operations */
 
 struct sd_op_template *get_sd_op(uint8_t opcode);



More information about the sheepdog mailing list