[sheepdog] [PATCH 1/4] sheep: don't send unnecessary data against read requests

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon Sep 10 12:49:14 CEST 2012


At Mon, 10 Sep 2012 18:11:37 +0800,
Liu Yuan wrote:
> 
> On 09/10/2012 05:54 PM, MORITA Kazutaka wrote:
> > I've also tried it, but it couldn't work.  A SD_OP_STAT_CLUSTER
> > request needs to receive epoch data even when the result is not
> > SD_RES_SUCCESS.  Although This patch looks a bit complicated, we
> > should explicitly specify the length of response data when the request
> > type is not SD_FLAG_CMD_WRITE, I think.
> 
> This will post rather burden to programmers and I guess in the future
> many people will be likely repeating to forget this kind of assignment.
> 
> I am not sure if we can modify STAT_CLUSTER to adopt to our expected
> changes.

I think we shouldn't do it because It is helpful to get epoch info
when the cluster status is not running.

> If not, we at least should provide one helper function to do
> the finale work of the failure request instead of manual hard-code.

I feel it is a bit dirty to introduce a helper only for setting
data_length.  How about setting zero to rsp->data_length by default?

diff --git a/sheep/request.c b/sheep/request.c
index 40a49fc..9988c4d 100644
--- a/sheep/request.c
+++ b/sheep/request.c
@@ -584,14 +584,10 @@ static inline int begin_rx(struct client_info *ci)
 static inline void finish_rx(struct client_info *ci)
 {
 	struct request *req;
-	struct sd_req *hdr = &ci->conn.rx_hdr;
 
 	req = ci->rx_req;
 	init_rx_hdr(ci);
-	if (hdr->flags & SD_FLAG_CMD_WRITE)
-		req->rp.data_length = 0;
-	else
-		req->rp.data_length = hdr->data_length;
+	req->rp.data_length = 0;
 
 	dprintf("%d, %s:%d\n", ci->conn.fd, ci->conn.ipstr, ci->conn.port);
 	queue_request(req);



More information about the sheepdog mailing list