[3/4] fs/fuse kio: add missed sock write in pcs_sock_sendmsg()

Submitted by Pavel Butsykin on April 15, 2019, 9:04 a.m.

Details

Message ID 20190415090401.13342-4-pbutsykin@virtuozzo.com
State New
Series "KIO performance fixes"
Headers show

Commit Message

Pavel Butsykin April 15, 2019, 9:04 a.m.
We need to write the ready data to socket, in case write_queue list is empty,
instead of rescheduling it. This will help maintain a balance between recv and
send, because after rescheduling the receive will be called first.

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_sock_io.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/kio/pcs/pcs_sock_io.c b/fs/fuse/kio/pcs/pcs_sock_io.c
index ede71c255084..e0699f57a007 100644
--- a/fs/fuse/kio/pcs/pcs_sock_io.c
+++ b/fs/fuse/kio/pcs/pcs_sock_io.c
@@ -415,6 +415,8 @@  int pcs_sockio_delayed_seg(struct pcs_sockio *sio)
 
 void pcs_sock_sendmsg(struct pcs_sockio * sio, struct pcs_msg *msg)
 {
+	int was_idle = list_empty(&sio->write_queue);
+
 	DTRACE("sio(%p) msg:%p\n", sio, msg);
 
 	if (pcs_if_error(&sio->error)) {
@@ -432,6 +434,10 @@  void pcs_sock_sendmsg(struct pcs_sockio * sio, struct pcs_msg *msg)
 	if (!(sio->flags & PCS_SOCK_F_POOLOUT))
 		sio->flags |= PCS_SOCK_F_POOLOUT;
 
+	if (was_idle) {
+		sio->flags &= ~PCS_SOCK_F_POOLOUT;
+		pcs_sockio_send(sio);
+	}
 }
 
 /* Try to cancel message send. If it is impossible, because message is in the middle