[sheepdog] [PATCH] sheep: avoid busy loop in do_client_tx

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Tue Oct 23 18:49:53 CEST 2012


When short write happens, we should wait for connection to be ready
for write in epoll_wait rather than doing busy loop in the main
thread.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/request.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sheep/request.c b/sheep/request.c
index 1f9e335..01a9908 100644
--- a/sheep/request.c
+++ b/sheep/request.c
@@ -709,17 +709,17 @@ static inline int finish_tx(struct client_info *ci)
 
 static void do_client_tx(struct client_info *ci)
 {
-	if (list_empty(&ci->done_reqs)) {
+	if (!ci->tx_req && list_empty(&ci->done_reqs)) {
 		if (conn_tx_off(&ci->conn))
 			clear_client_info(ci);
 		return;
 	}
-again:
+
 	if (begin_tx(ci) < 0)
 		return;
 
 	if (finish_tx(ci))
-		goto again;
+		return;
 
 	/* Let's go sleep, and put_request() will wake me up */
 	if (conn_tx_off(&ci->conn))
-- 
1.7.2.5




More information about the sheepdog mailing list