[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 20/29] migration/multifd: Add incoming QIOChannelFile supp
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH v2 20/29] migration/multifd: Add incoming QIOChannelFile support |
Date: |
Wed, 25 Oct 2023 11:29:13 +0100 |
User-agent: |
Mutt/2.2.9 (2022-11-12) |
On Mon, Oct 23, 2023 at 05:35:59PM -0300, Fabiano Rosas wrote:
> On the receiving side we don't need to differentiate between main
> channel and threads, so whichever channel is defined first gets to be
> the main one. And since there are no packets, use the atomic channel
> count to index into the params array.
>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
> migration/file.c | 39 +++++++++++++++++++++++++++++----------
> migration/migration.c | 2 ++
> migration/multifd.c | 7 ++++++-
> migration/multifd.h | 1 +
> 4 files changed, 38 insertions(+), 11 deletions(-)
>
> diff --git a/migration/file.c b/migration/file.c
> index 93b9b7bf5d..ad75225f43 100644
> --- a/migration/file.c
> +++ b/migration/file.c
> @@ -6,13 +6,15 @@
> */
>
> #include "qemu/osdep.h"
> -#include "qemu/cutils.h"
> #include "qapi/error.h"
> +#include "qemu/cutils.h"
> +#include "qemu/error-report.h"
> #include "channel.h"
> #include "file.h"
> #include "migration.h"
> #include "io/channel-file.h"
> #include "io/channel-util.h"
> +#include "options.h"
> #include "trace.h"
>
> #define OFFSET_OPTION ",offset="
> @@ -136,7 +138,8 @@ void file_start_incoming_migration(const char *filespec,
> Error **errp)
> g_autofree char *filename = g_strdup(filespec);
> QIOChannelFile *fioc = NULL;
> uint64_t offset = 0;
> - QIOChannel *ioc;
> + int channels = 1;
> + int i = 0, fd;
>
> trace_migration_file_incoming(filename);
>
> @@ -146,16 +149,32 @@ void file_start_incoming_migration(const char
> *filespec, Error **errp)
>
> fioc = qio_channel_file_new_path(filename, O_RDONLY, 0, errp);
> if (!fioc) {
> - return;
> + goto out;
> + }
> +
> + if (migrate_multifd()) {
> + channels += migrate_multifd_channels();
> }
>
> - ioc = QIO_CHANNEL(fioc);
> - if (offset && qio_channel_io_seek(ioc, offset, SEEK_SET, errp) < 0) {
> + fd = fioc->fd;
> +
> + do {
> + QIOChannel *ioc = QIO_CHANNEL(fioc);
> +
> + if (offset && qio_channel_io_seek(ioc, offset, SEEK_SET, errp) < 0) {
> + return;
> + }
> +
> + qio_channel_set_name(ioc, "migration-file-incoming");
> + qio_channel_add_watch_full(ioc, G_IO_IN,
> + file_accept_incoming_migration,
> + NULL, NULL,
> + g_main_context_get_thread_default());
> + } while (++i < channels && (fioc = qio_channel_file_new_fd(fd)));
IIUC, this loop is failing to call qio_channel_io_seek to set
the offset on the last 'fioc' that is created.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- [PATCH v2 17/29] tests/qtest: migration-test: Add tests for fixed-ram file-based migration, (continued)
Re: [PATCH v2 19/29] migration/multifd: Add outgoing QIOChannelFile support, Peter Xu, 2023/10/31
[PATCH v2 18/29] migration/multifd: Allow multifd without packets, Fabiano Rosas, 2023/10/23
[PATCH v2 20/29] migration/multifd: Add incoming QIOChannelFile support, Fabiano Rosas, 2023/10/23
[PATCH v2 24/29] migration/ram: Ignore multifd flush when doing fixed-ram migration, Fabiano Rosas, 2023/10/23
[PATCH v2 21/29] migration/multifd: Add pages to the receiving side, Fabiano Rosas, 2023/10/23
[PATCH v2 22/29] io: Add a pwritev/preadv version that takes a discontiguous iovec, Fabiano Rosas, 2023/10/23
[PATCH v2 23/29] migration/ram: Add a wrapper for fixed-ram shadow bitmap, Fabiano Rosas, 2023/10/23