NBD changes for 2013-04-19
The following changes since commit e2ec3f976803b360c70d9ae2ba13852fa5d11665:
qjson: to_json() case QTYPE_QSTRING is buggy, rewrite (2013-04-13 19:40:25 +0000)
are available in the git repository at:
git://github.com/bonzini/qemu.git nbd-next
for you to fetch changes up to 97ebbab0e324831dff47dbfa4bed55808cb3ec74:
nbd: set TCP_NODELAY (2013-04-15 16:35:17 +0200)
----------------------------------------------------------------
Stefan Hajnoczi (3):
nbd: unlock mutex in nbd_co_send_request() error path
nbd: use TCP_CORK in nbd_co_send_request()
nbd: set TCP_NODELAY
block/nbd.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
Signature · 1 line
1.8.1.4
PATCH 1/3 nbd: unlock mutex in nbd_co_send_request() error path
From: Stefan Hajnoczi <[email protected]>
--- block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/nbd.c +1 -1
@@ -339,7 +339,7 @@ static int nbd_co_send_request(BDRVNBDState *s, struct nbd_request *request, ret =qemu_co_sendv (s->sock, qiov->iov, qiov->niov, offset, request->len);if (ret != request->len) { -return -EIO ; + rc = -EIO ; } } qemu_aio_set_fd_handler(s->sock, nbd_reply_ready, NULL,
Signature · 1 line
1.8.1.4
PATCH 2/3 nbd: use TCP_CORK in nbd_co_send_request()
In reply to Paolo BonziniFrom: Stefan Hajnoczi <[email protected]>
Use TCP_CORK to defer packet transmission until both the header and the payload have been written.
--- block/nbd.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
block/nbd.c +16 -6
@@ -334,13 +334,23 @@ static int nbd_co_send_request(BDRVNBDState *s, struct nbd_request *request, s->send_coroutine =qemu_coroutine_self ();qemu_aio_set_fd_handler (s->sock, nbd_reply_ready, nbd_restart_write, nbd_have_request, s); - rc =nbd_send_request (s->sock, request); -if (rc >=0 && qiov) { - ret =qemu_co_sendv (s->sock, qiov->iov, qiov->niov, - offset, request->len); -if (ret != request->len) { - rc = -EIO ; +if (qiov) { +if (!s->is_unix) { +socket_set_cork (s->sock,1 ); } + rc =nbd_send_request (s->sock, request); +if (rc >=0 ) { + ret =qemu_co_sendv (s->sock, qiov->iov, qiov->niov, + offset, request->len); +if (ret != request->len) { + rc = -EIO ; + } + } +if (!s->is_unix) { +socket_set_cork (s->sock,0 ); + } + }else { + rc =nbd_send_request (s->sock, request); }qemu_aio_set_fd_handler (s->sock, nbd_reply_ready,NULL , nbd_have_request, s);
Signature · 1 line
1.8.1.4
PATCH 3/3 nbd: set TCP_NODELAY
In reply to Paolo BonziniFrom: Stefan Hajnoczi <[email protected]>
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.
--- block/nbd.c | 3 +++ 1 file changed, 3 insertions(+)
block/nbd.c +3 -0
@@ -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 */
Signature · 1 line
1.8.1.4