]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
multifd: Only send pages when packet are not empty
authorJuan Quintela <quintela@redhat.com>
Fri, 4 Jan 2019 18:12:35 +0000 (19:12 +0100)
committerJuan Quintela <quintela@redhat.com>
Mon, 25 Mar 2019 17:13:37 +0000 (18:13 +0100)
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>
migration/ram.c

index 35bd6213e91757f9c3b4ba936d8fae1b01775abc..3034f862c14f2bd5443a9473bc2c9605c7e8c11e 100644 (file)
@@ -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) {