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

---
 sheep/gateway.c    |   17 -----------------
 sheep/group.c      |   11 +----------
 sheep/ops.c        |   18 ++++++++++++++++--
 sheep/sdnet.c      |   17 +++--------------
 sheep/sheep_priv.h |    4 +---
 sheep/store.c      |   16 ----------------
 6 files changed, 21 insertions(+), 62 deletions(-)

Index: sheepdog/sheep/ops.c
===================================================================
--- sheepdog.orig/sheep/ops.c	2012-07-03 21:35:50.503683198 +0200
+++ sheepdog/sheep/ops.c	2012-07-03 21:38:35.333682215 +0200
@@ -999,9 +999,23 @@ int has_process_main(struct sd_op_templa
 	return !!op->process_main;
 }
 
-int do_process_work(struct request *req)
+void do_process_work(struct work *work)
 {
-	return req->op->process_work(req);
+	struct request *req = container_of(work, struct request, work);
+	int ret = SD_RES_SUCCESS;
+
+	dprintf("%x, %" PRIx64" , %u\n",
+		req->rq.opcode, req->rq.obj.oid, req->rq.epoch);
+
+	if (req->op->process_work)
+		ret = req->op->process_work(req);
+
+	if (ret != SD_RES_SUCCESS) {
+		dprintf("failed: %x, %" PRIx64" , %u, %"PRIx32"\n",
+			req->rq.opcode, req->rq.obj.oid, req->rq.epoch, ret);
+	}
+
+	req->rp.result = ret;
 }
 
 int do_process_main(struct sd_op_template *op, const struct sd_req *req,
Index: sheepdog/sheep/sdnet.c
===================================================================
--- sheepdog.orig/sheep/sdnet.c	2012-07-03 21:36:48.403682851 +0200
+++ sheepdog/sheep/sdnet.c	2012-07-03 21:37:22.100349316 +0200
@@ -107,17 +107,6 @@ static void local_op_done(struct work *w
 	put_request(req);
 }
 
-static void do_local_request(struct work *work)
-{
-	struct request *req = container_of(work, struct request, work);
-	int ret = SD_RES_SUCCESS;
-
-	if (has_process_work(req->op))
-		ret = do_process_work(req);
-
-	req->rp.result = ret;
-}
-
 static int check_request_epoch(struct request *req)
 {
 	if (before(req->rq.epoch, sys->epoch)) {
@@ -265,7 +254,7 @@ static void queue_io_request(struct requ
 	if (req->rq.flags & SD_FLAG_CMD_RECOVERY)
 		req->rq.epoch = req->rq.obj.tgt_epoch;
 
-	req->work.fn = do_io_request;
+	req->work.fn = do_process_work;
 	req->work.done = io_op_done;
 	queue_work(sys->io_wqueue, &req->work);
 }
@@ -290,14 +279,14 @@ static void queue_gateway_request(struct
 			return;
 
 queue_work:
-	req->work.fn = do_gateway_request;
+	req->work.fn = do_process_work;
 	req->work.done = gateway_op_done;
 	queue_work(sys->gateway_wqueue, &req->work);
 }
 
 static void queue_local_request(struct request *req)
 {
-	req->work.fn = do_local_request;
+	req->work.fn = do_process_work;
 	req->work.done = local_op_done;
 	queue_work(sys->io_wqueue, &req->work);
 }
Index: sheepdog/sheep/gateway.c
===================================================================
--- sheepdog.orig/sheep/gateway.c	2012-07-03 21:35:50.500349864 +0200
+++ sheepdog/sheep/gateway.c	2012-07-03 21:37:22.100349316 +0200
@@ -307,20 +307,3 @@ int gateway_create_and_write_obj(struct
 {
 	return forward_write_obj_req(req, true);
 }
-
-void do_gateway_request(struct work *work)
-{
-	struct request *req = container_of(work, struct request, work);
-	int ret = SD_RES_SUCCESS;
-
-	dprintf("%x, %" PRIx64" , %u\n",
-		req->rq.opcode, req->rq.obj.oid, req->rq.epoch);
-
-	if (has_process_work(req->op))
-		ret = do_process_work(req);
-
-	if (ret != SD_RES_SUCCESS)
-		dprintf("failed: %x, %" PRIx64" , %u, %"PRIx32"\n",
-			req->rq.opcode, req->rq.obj.oid, req->rq.epoch, ret);
-	req->rp.result = ret;
-}
Index: sheepdog/sheep/group.c
===================================================================
--- sheepdog.orig/sheep/group.c	2012-07-03 21:32:40.080351001 +0200
+++ sheepdog/sheep/group.c	2012-07-03 21:37:22.100349316 +0200
@@ -279,15 +279,6 @@ static struct vdi_op_message *prepare_cl
 	return msg;
 }
 
-static void do_cluster_request(struct work *work)
-{
-	struct request *req = container_of(work, struct request, work);
-	int ret;
-
-	ret = do_process_work(req);
-	req->rp.result = ret;
-}
-
 static void cluster_op_done(struct work *work)
 {
 	struct request *req = container_of(work, struct request, work);
@@ -328,7 +319,7 @@ bool sd_block_handler(struct sd_node *se
 
 	req = list_first_entry(&sys->pending_list,
 				struct request, pending_list);
-	req->work.fn = do_cluster_request;
+	req->work.fn = do_process_work;
 	req->work.done = cluster_op_done;
 
 	queue_work(sys->block_wqueue, &req->work);
Index: sheepdog/sheep/sheep_priv.h
===================================================================
--- sheepdog.orig/sheep/sheep_priv.h	2012-07-03 21:35:50.503683198 +0200
+++ sheepdog/sheep/sheep_priv.h	2012-07-03 21:38:07.483682379 +0200
@@ -236,8 +236,6 @@ int create_cluster(int port, int64_t zon
 int leave_cluster(void);
 
 void queue_cluster_request(struct request *req);
-void do_io_request(struct work *work);
-void do_gateway_request(struct work *work);
 
 int update_epoch_log(uint32_t epoch, struct sd_node *nodes, size_t nr_nodes);
 int log_current_epoch(void);
@@ -293,7 +291,7 @@ int is_gateway_op(struct sd_op_template
 int is_force_op(struct sd_op_template *op);
 int has_process_work(struct sd_op_template *op);
 int has_process_main(struct sd_op_template *op);
-int do_process_work(struct request *req);
+void do_process_work(struct work *work);
 int do_process_main(struct sd_op_template *op, const struct sd_req *req,
 		    struct sd_rsp *rsp, void *data);
 
Index: sheepdog/sheep/store.c
===================================================================
--- sheepdog.orig/sheep/store.c	2012-07-03 21:36:48.403682851 +0200
+++ sheepdog/sheep/store.c	2012-07-03 21:37:22.100349316 +0200
@@ -82,22 +82,6 @@ err_open:
 	return -1;
 }
 
-void do_io_request(struct work *work)
-{
-	struct request *req = container_of(work, struct request, work);
-	int ret;
-
-	dprintf("%x, %" PRIx64" , %u\n",
-		req->rq.opcode, req->rq.obj.oid, req->rq.epoch);
-
-	ret = do_process_work(req);
-
-	if (ret != SD_RES_SUCCESS)
-		dprintf("failed: %x, %" PRIx64" , %u, %"PRIx32"\n",
-			req->rq.opcode, req->rq.obj.oid, req->rq.epoch, ret);
-	req->rp.result = ret;
-}
-
 int epoch_log_read_remote(uint32_t epoch, struct sd_node *nodes, int len)
 {
 	int i, ret;


