[Sheepdog] [PATCH] sheep: call req_done directly
Christoph Hellwig
hch at infradead.org
Thu Apr 26 18:15:47 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-04-26 18:03:55.660555635 +0200
+++ sheepdog/sheep/group.c 2012-04-26 18:04:45.224556904 +0200
@@ -627,7 +627,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-04-26 18:03:55.660555635 +0200
+++ sheepdog/sheep/sdnet.c 2012-04-26 18:04:45.224556904 +0200
@@ -149,7 +149,7 @@ static void io_op_done(struct work *work
resume_pending_requests();
resume_recovery_work();
- req->done(req);
+ req_done(req);
return;
retry:
@@ -173,7 +173,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)
@@ -261,8 +261,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);
@@ -305,8 +304,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;
}
/*
* we set epoch for non direct requests here. Note that we
@@ -330,7 +328,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);
@@ -375,7 +373,7 @@ static void free_request(struct request
free(req);
}
-static void req_done(struct request *req)
+void req_done(struct request *req)
{
int dead = 0;
struct client_info *ci = req->ci;
@@ -467,8 +465,6 @@ static void client_rx_handler(struct cli
else
req->rp.data_length = hdr->data_length;
- req->done = req_done;
-
queue_request(req);
}
Index: sheepdog/sheep/sheep_priv.h
===================================================================
--- sheepdog.orig/sheep/sheep_priv.h 2012-04-26 18:03:55.660555635 +0200
+++ sheepdog/sheep/sheep_priv.h 2012-04-26 18:04:45.224556904 +0200
@@ -65,8 +65,6 @@ struct client_info {
struct request;
struct vnode_info;
-typedef void (*req_end_t) (struct request *);
-
struct request {
struct event_struct cev;
struct sd_req rq;
@@ -88,7 +86,6 @@ struct request {
struct vnode_info *vnodes;
int check_consistency;
- req_end_t done;
struct work work;
};
@@ -312,6 +309,8 @@ int rmdir_r(char *dir_path);
int prealloc(int fd, uint32_t size);
+void req_done(struct request *req);
+
/* Operations */
struct sd_op_template *get_sd_op(uint8_t opcode);
More information about the sheepdog
mailing list