[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 2/8] migration/multifd/zero-copy: Create helper function for flush
From: |
Juan Quintela |
Subject: |
[PULL 2/8] migration/multifd/zero-copy: Create helper function for flushing |
Date: |
Mon, 21 Nov 2022 13:59:01 +0100 |
From: Leonardo Bras <leobras@redhat.com>
Move flushing code from multifd_send_sync_main() to a new helper, and call
it in multifd_send_sync_main().
Signed-off-by: Leonardo Bras <leobras@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/multifd.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/migration/multifd.c b/migration/multifd.c
index 586ddc9d65..509bbbe3bf 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -566,6 +566,23 @@ void multifd_save_cleanup(void)
multifd_send_state = NULL;
}
+static int multifd_zero_copy_flush(QIOChannel *c)
+{
+ int ret;
+ Error *err = NULL;
+
+ ret = qio_channel_flush(c, &err);
+ if (ret < 0) {
+ error_report_err(err);
+ return -1;
+ }
+ if (ret == 1) {
+ dirty_sync_missed_zero_copy();
+ }
+
+ return ret;
+}
+
int multifd_send_sync_main(QEMUFile *f)
{
int i;
@@ -616,17 +633,8 @@ int multifd_send_sync_main(QEMUFile *f)
qemu_mutex_unlock(&p->mutex);
qemu_sem_post(&p->sem);
- if (flush_zero_copy && p->c) {
- int ret;
- Error *err = NULL;
-
- ret = qio_channel_flush(p->c, &err);
- if (ret < 0) {
- error_report_err(err);
- return -1;
- } else if (ret == 1) {
- dirty_sync_missed_zero_copy();
- }
+ if (flush_zero_copy && p->c && (multifd_zero_copy_flush(p->c) < 0)) {
+ return -1;
}
}
for (i = 0; i < migrate_multifd_channels(); i++) {
--
2.38.1
- [PULL 0/8] Next patches, Juan Quintela, 2022/11/21
- [PULL 1/8] migration/channel-block: fix return value for qio_channel_block_{readv, writev}, Juan Quintela, 2022/11/21
- [PULL 2/8] migration/multifd/zero-copy: Create helper function for flushing,
Juan Quintela <=
- [PULL 3/8] migration: Fix possible infinite loop of ram save process, Juan Quintela, 2022/11/21
- [PULL 4/8] migration: Fix race on qemu_file_shutdown(), Juan Quintela, 2022/11/21
- [PULL 5/8] migration: Disallow postcopy preempt to be used with compress, Juan Quintela, 2022/11/21
- [PULL 8/8] migration: Block migration comment or code is wrong, Juan Quintela, 2022/11/21
- [PULL 7/8] migration: Disable multifd explicitly with compression, Juan Quintela, 2022/11/21
- [PULL 6/8] migration: Use non-atomic ops for clear log bitmap, Juan Quintela, 2022/11/21
- Re: [PULL 0/8] Next patches, Stefan Hajnoczi, 2022/11/21