Patchwork [3/3] nbd: set TCP_NODELAY

login
register
mail settings
Submitter Stefan Hajnoczi
Date April 15, 2013, 2:14 p.m.
Message ID <1366035288-15840-4-git-send-email-stefanha@redhat.com>
Download mbox | patch
Permalink /patch/236616/
State New
Headers show

Comments

Stefan Hajnoczi - April 15, 2013, 2:14 p.m.
Disable the Nagle algorithm to reduce latency.  Note this means we must
also use TCP_CORK when sending header followed by payload to avoid
fragmenting lots of little packets.  The previous patch took care of
that.

Suggested-by: Nick Thomas <nick@bytemark.co.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/nbd.c | 3 +++
 1 file changed, 3 insertions(+)

Patch

diff --git a/block/nbd.c b/block/nbd.c
index 485bbf0..d9dc454 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -406,6 +406,9 @@  static int nbd_establish_connection(BlockDriverState *bs)
         sock = unix_socket_outgoing(qemu_opt_get(s->socket_opts, "path"));
     } else {
         sock = tcp_socket_outgoing_opts(s->socket_opts);
+        if (sock >= 0) {
+            socket_set_nodelay(sock);
+        }
     }
 
     /* Failed to establish connection */