提交 ad24c7cb 编写于 作者: J Juan Quintela

multifd: Only send pages when packet are not empty

We send packages without pages sometimes for sysnchronizanion.  The
iov functions do the right thing, but we will be changing this code in
future patches.
Signed-off-by: NJuan Quintela <quintela@redhat.com>
Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: NJuan Quintela <quintela@redhat.com>
上级 50ccc488
......@@ -1088,9 +1088,12 @@ static void *multifd_send_thread(void *opaque)
break;
}
ret = qio_channel_writev_all(p->c, p->pages->iov, used, &local_err);
if (ret != 0) {
break;
if (used) {
ret = qio_channel_writev_all(p->c, p->pages->iov,
used, &local_err);
if (ret != 0) {
break;
}
}
qemu_mutex_lock(&p->mutex);
......@@ -1317,9 +1320,12 @@ static void *multifd_recv_thread(void *opaque)
p->num_pages += used;
qemu_mutex_unlock(&p->mutex);
ret = qio_channel_readv_all(p->c, p->pages->iov, used, &local_err);
if (ret != 0) {
break;
if (used) {
ret = qio_channel_readv_all(p->c, p->pages->iov,
used, &local_err);
if (ret != 0) {
break;
}
}
if (flags & MULTIFD_FLAG_SYNC) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册