On Mon, Oct 23, 2023 at 05:35:58PM -0300, Fabiano Rosas wrote: > Allow multifd to open file-backed channels. This will be used when > enabling the fixed-ram migration stream format which expects a > seekable transport. > > The QIOChannel read and write methods will use the preadv/pwritev > versions which don't update the file offset at each call so we can > reuse the fd without re-opening for every channel. > > Note that this is just setup code and multifd cannot yet make use of > the file channels. > > Signed-off-by: Fabiano Rosas <faro...@suse.de> > --- > migration/file.c | 64 +++++++++++++++++++++++++++++++++++++++++-- > migration/file.h | 10 +++++-- > migration/migration.c | 2 +- > migration/multifd.c | 14 ++++++++-- > migration/options.c | 7 +++++ > migration/options.h | 1 + > 6 files changed, 90 insertions(+), 8 deletions(-) > > diff --git a/migration/file.c b/migration/file.c > index cf5b1bf365..93b9b7bf5d 100644 > --- a/migration/file.c > +++ b/migration/file.c > @@ -17,6 +17,12 @@ > > #define OFFSET_OPTION ",offset=" > > +static struct FileOutgoingArgs { > + char *fname; > + int flags; > + int mode; > +} outgoing_args; > + > /* Remove the offset option from @filespec and return it in @offsetp. */ > > static int file_parse_offset(char *filespec, uint64_t *offsetp, Error **errp) > @@ -36,13 +42,62 @@ static int file_parse_offset(char *filespec, uint64_t > *offsetp, Error **errp) > return 0; > } > > +static void qio_channel_file_connect_worker(QIOTask *task, gpointer opaque) > +{ > + /* noop */ > +} > + > +static void file_migration_cancel(Error *errp) > +{ > + MigrationState *s; > + > + s = migrate_get_current(); > + > + migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, > + MIGRATION_STATUS_FAILED);
This doesn't sound right to set FAILED here, then call cancel() afterwards (which will try to set it to CANCELLING). For socket based, multifd sets error and kick main in multifd_new_send_channel_cleanup(). Can it be done similarly, rather than calling migration_cancel()? > + migration_cancel(errp); > +} -- Peter Xu