[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/20] migration: convert savevm to use QIOChannelBlock for VMSta
From: |
Daniel P . Berrangé |
Subject: |
[PATCH 09/20] migration: convert savevm to use QIOChannelBlock for VMState |
Date: |
Tue, 24 May 2022 12:02:24 +0100 |
With this change, all QEMUFile usage is backed by QIOChannel at
last.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
migration/savevm.c | 42 ++++--------------------------------------
1 file changed, 4 insertions(+), 38 deletions(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index 75d05f1a84..24a50376dc 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -35,6 +35,7 @@
#include "migration/misc.h"
#include "migration/register.h"
#include "migration/global_state.h"
+#include "migration/channel-block.h"
#include "ram.h"
#include "qemu-file-channel.h"
#include "qemu-file.h"
@@ -130,48 +131,13 @@ static struct mig_cmd_args {
/***********************************************************/
/* savevm/loadvm support */
-static ssize_t block_writev_buffer(void *opaque, struct iovec *iov, int iovcnt,
- int64_t pos, Error **errp)
-{
- int ret;
- QEMUIOVector qiov;
-
- qemu_iovec_init_external(&qiov, iov, iovcnt);
- ret = bdrv_writev_vmstate(opaque, &qiov, pos);
- if (ret < 0) {
- return ret;
- }
-
- return qiov.size;
-}
-
-static ssize_t block_get_buffer(void *opaque, uint8_t *buf, int64_t pos,
- size_t size, Error **errp)
-{
- return bdrv_load_vmstate(opaque, buf, pos, size);
-}
-
-static int bdrv_fclose(void *opaque, Error **errp)
-{
- return bdrv_flush(opaque);
-}
-
-static const QEMUFileOps bdrv_read_ops = {
- .get_buffer = block_get_buffer,
- .close = bdrv_fclose
-};
-
-static const QEMUFileOps bdrv_write_ops = {
- .writev_buffer = block_writev_buffer,
- .close = bdrv_fclose
-};
-
static QEMUFile *qemu_fopen_bdrv(BlockDriverState *bs, int is_writable)
{
if (is_writable) {
- return qemu_fopen_ops(bs, &bdrv_write_ops, false);
+ return
qemu_fopen_channel_output(QIO_CHANNEL(qio_channel_block_new(bs)));
+ } else {
+ return
qemu_fopen_channel_input(QIO_CHANNEL(qio_channel_block_new(bs)));
}
- return qemu_fopen_ops(bs, &bdrv_read_ops, false);
}
--
2.36.1
- [PATCH 00/20] migration: remove QEMUFileOps concept and assume use of QIOChannel, Daniel P . Berrangé, 2022/05/24
- [PATCH 04/20] migration: rename rate limiting fields in QEMUFile, Daniel P . Berrangé, 2022/05/24
- [PATCH 05/20] migration: rename 'pos' field in QEMUFile to 'bytes_processed', Daniel P . Berrangé, 2022/05/24
- [PATCH 02/20] migration: switch to use QIOChannelNull for dummy channel, Daniel P . Berrangé, 2022/05/24
- [PATCH 07/20] migration: rename qemu_update_position to qemu_file_credit_transfer, Daniel P . Berrangé, 2022/05/24
- [PATCH 09/20] migration: convert savevm to use QIOChannelBlock for VMState,
Daniel P . Berrangé <=
- [PATCH 10/20] migration: stop passing 'opaque' parameter to QEMUFile hooks, Daniel P . Berrangé, 2022/05/24
- [PATCH 13/20] migration: remove unused QEMUFileGetFD typedef, Daniel P . Berrangé, 2022/05/24
- [PATCH 06/20] migration: rename qemu_ftell to qemu_file_total_transferred, Daniel P . Berrangé, 2022/05/24
- [PATCH 01/20] io: add a QIOChannelNull equivalent to /dev/null, Daniel P . Berrangé, 2022/05/24
- [PATCH 11/20] migration: hardcode assumption that QEMUFile is backed with QIOChannel, Daniel P . Berrangé, 2022/05/24
- [PATCH 03/20] migration: remove unreachble RDMA code in save_hook impl, Daniel P . Berrangé, 2022/05/24
- [PATCH 15/20] migration: remove the QEMUFileOps 'set_blocking' callback, Daniel P . Berrangé, 2022/05/24
- [PATCH 12/20] migration: introduce new constructors for QEMUFile, Daniel P . Berrangé, 2022/05/24