qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 04/16] qemu-file: Don't call qemu_fflush() for read only files


From: Juan Quintela
Subject: [PATCH 04/16] qemu-file: Don't call qemu_fflush() for read only files
Date: Tue, 30 May 2023 14:28:01 +0200

This was the only caller for read only files.  So change the test for
an assert in qemu_fflush().

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration/qemu-file.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index 7a5c1a5e32..38984504ba 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -272,9 +272,7 @@ static void qemu_iovec_release_ram(QEMUFile *f)
  */
 void qemu_fflush(QEMUFile *f)
 {
-    if (!qemu_file_is_writable(f)) {
-        return;
-    }
+    g_assert(qemu_file_is_writable(f));
 
     if (qemu_file_get_error(f)) {
         return;
@@ -363,7 +361,9 @@ static ssize_t coroutine_mixed_fn qemu_fill_buffer(QEMUFile 
*f)
 int qemu_fclose(QEMUFile *f)
 {
     int ret, ret2;
-    qemu_fflush(f);
+    if (qemu_file_is_writable(f)) {
+        qemu_fflush(f);
+    }
     ret = qemu_file_get_error(f);
 
     ret2 = qio_channel_close(f->ioc, NULL);
-- 
2.40.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]