diff options
author | Juan Quintela <quintela@redhat.com> | 2019-01-04 19:12:35 +0100 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2019-03-25 18:13:37 +0100 |
commit | ad24c7cb595e7ff3df17f7db790e2a7dfaf8040c (patch) | |
tree | b4b279e6a9a62b686595af998914604deb9cf1f5 /migration/ram.c | |
parent | 50ccc488b0d4c3b8e2790c18bcd7329fc609a1c6 (diff) |
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: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration/ram.c')
-rw-r--r-- | migration/ram.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/migration/ram.c b/migration/ram.c index 35bd6213e9..3034f862c1 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -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) { |