aboutsummaryrefslogtreecommitdiff
path: root/migration/savevm.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-06-23 10:14:20 -0700
committerRichard Henderson <richard.henderson@linaro.org>2022-06-23 10:14:20 -0700
commit7db86fe2ed220c196061824e652b94e7a2acbabf (patch)
treed2080d38851cdaebb0b2c6f1c3dd08e9b0c7dff5 /migration/savevm.c
parent2b049d2c8dc01de750410f8f1a4eac498c04c723 (diff)
parent77ef2dc1c8c6a482fd06fdf3b59d0647f0850e3e (diff)
Merge tag 'pull-migration-20220623b' of https://gitlab.com/dagrh/qemu into staging
[v3] Migration pull 2022-06-23 This replaces my and Juan's earlier pulls over the last 2 days; 4th time lucky? Compared to my pull earlier: Removed Hyman's dirty ring set In this migration PULL request: - Dainiel Berrangé - qemufileops cleanup - Leonardo Bras - cleanups for zero copy - Juan Quintela - RDMA cleanups Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEERfXHG0oMt/uXep+pBRYzHrxb/ecFAmK0mnwACgkQBRYzHrxb # /ecJYQ/8DdQBVYpJjpHj3mBx39aXodM7uM4Jt1okuSF92y9KRSNdIs3nvvwWAZbL # dWAUHUZBNOfZF7Eqe6WWCIDNxUTz88RkMM16N3+a5sqBa0xU6rP6cvyw9vYrnsmx # aHVQ1ESosTby2qcb1ofjYRXWNt7GhDtRIH55m3mSalP/WAgjMe3MsrAtz66T4w55 # 4paTVwgS/WMuLD9dqyESyofePnvtM8z3ye2a75JRscBQYmpO+XuX3IX5ah6m439s # fI1BezQU2Q4YNDmCEWvdfZ2tqgcfi8dHnu0JB9QTfbkPVh9jw25VPpnymimMB7iW # MlXAlDr7m9HQI6OjIkq8pXBcgWQpbVGMon1CcrDmGCReEjnQ5lTsb27fkXzf/Nwu # 09iuNfYGcSGAbZ8GZa/lrRTGeINrSj99uOVxrTvVS0db2+1va3hkamGMULhsdX6O # smOrje79pVLAr7JJSMH2bqFv9cKtLu77HndSVtswkRRMhtDU+VQI5FxYlwueuawJ # toDM4DJMd3pJHIpPrUwxlo4D9dkdxPfqC1GATDPxw9/vYgbORn8fkt5g9EYxBzc0 # pWRY9SNuw0MC54JGEoFc77+VKJXK1A97j9GoF+Vyoh30yTgZ3q9tm2eElpYwtHDy # t8zEVC9QadcgMdRAnJqgZgaWdfwKiHpjplSn5lOGDLOo7gfSmik= # =ajVU # -----END PGP SIGNATURE----- # gpg: Signature made Thu 23 Jun 2022 09:53:16 AM PDT # gpg: using RSA key 45F5C71B4A0CB7FB977A9FA90516331EBC5BFDE7 # gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" [full] * tag 'pull-migration-20220623b' of https://gitlab.com/dagrh/qemu: (25 commits) migration: remove the QEMUFileOps abstraction migration: remove the QEMUFileOps 'get_return_path' callback migration: remove the QEMUFileOps 'writev_buffer' callback migration: remove the QEMUFileOps 'get_buffer' callback migration: remove the QEMUFileOps 'close' callback migration: remove the QEMUFileOps 'set_blocking' callback migration: remove the QEMUFileOps 'shut_down' callback migration: remove unused QEMUFileGetFD typedef / qemu_get_fd method migration: introduce new constructors for QEMUFile migration: hardcode assumption that QEMUFile is backed with QIOChannel migration: stop passing 'opaque' parameter to QEMUFile hooks migration: convert savevm to use QIOChannelBlock for VMState migration: introduce a QIOChannel impl for BlockDriverState VMState migration: rename qemu_file_update_transfer to qemu_file_acct_rate_limit migration: rename qemu_update_position to qemu_file_credit_transfer migration: rename qemu_ftell to qemu_file_total_transferred migration: rename 'pos' field in QEMUFile to 'bytes_processed' migration: rename rate limiting fields in QEMUFile migration: remove unreachble RDMA code in save_hook impl migration: switch to use QIOChannelNull for dummy channel ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'migration/savevm.c')
-rw-r--r--migration/savevm.c55
1 files changed, 10 insertions, 45 deletions
diff --git a/migration/savevm.c b/migration/savevm.c
index d9076897b8..e8a1b96fcd 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -35,8 +35,8 @@
#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"
#include "savevm.h"
#include "postcopy-ram.h"
@@ -130,48 +130,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_file_new_output(QIO_CHANNEL(qio_channel_block_new(bs)));
+ } else {
+ return qemu_file_new_input(QIO_CHANNEL(qio_channel_block_new(bs)));
}
- return qemu_fopen_ops(bs, &bdrv_read_ops, false);
}
@@ -916,9 +881,9 @@ static void vmstate_save_old_style(QEMUFile *f, SaveStateEntry *se,
{
int64_t old_offset, size;
- old_offset = qemu_ftell_fast(f);
+ old_offset = qemu_file_total_transferred_fast(f);
se->ops->save_state(f, se->opaque);
- size = qemu_ftell_fast(f) - old_offset;
+ size = qemu_file_total_transferred_fast(f) - old_offset;
if (vmdesc) {
json_writer_int64(vmdesc, "size", size);
@@ -2193,7 +2158,7 @@ static int loadvm_handle_cmd_packaged(MigrationIncomingState *mis)
bioc->usage += length;
trace_loadvm_handle_cmd_packaged_received(ret);
- QEMUFile *packf = qemu_fopen_channel_input(QIO_CHANNEL(bioc));
+ QEMUFile *packf = qemu_file_new_input(QIO_CHANNEL(bioc));
ret = qemu_loadvm_state_main(packf, mis);
trace_loadvm_handle_cmd_packaged_main(ret);
@@ -2887,7 +2852,7 @@ bool save_snapshot(const char *name, bool overwrite, const char *vmstate,
goto the_end;
}
ret = qemu_savevm_state(f, errp);
- vm_state_size = qemu_ftell(f);
+ vm_state_size = qemu_file_total_transferred(f);
ret2 = qemu_fclose(f);
if (ret < 0) {
goto the_end;
@@ -2951,7 +2916,7 @@ void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live,
goto the_end;
}
qio_channel_set_name(QIO_CHANNEL(ioc), "migration-xen-save-state");
- f = qemu_fopen_channel_output(QIO_CHANNEL(ioc));
+ f = qemu_file_new_output(QIO_CHANNEL(ioc));
object_unref(OBJECT(ioc));
ret = qemu_save_device_state(f);
if (ret < 0 || qemu_fclose(f) < 0) {
@@ -2998,7 +2963,7 @@ void qmp_xen_load_devices_state(const char *filename, Error **errp)
return;
}
qio_channel_set_name(QIO_CHANNEL(ioc), "migration-xen-load-state");
- f = qemu_fopen_channel_input(QIO_CHANNEL(ioc));
+ f = qemu_file_new_input(QIO_CHANNEL(ioc));
object_unref(OBJECT(ioc));
ret = qemu_loadvm_state(f);