qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Nikolay Borisov <nborisov@suse.com>
Cc: dgilbert@redhat.com, qemu-devel@nongnu.org, jfehlig@suse.com,
	Claudio.Fontana@suse.com, dfaggioli@suse.com
Subject: Re: [PATCH v2 05/11] io: Add support for seekable channels
Date: Tue, 18 Oct 2022 11:14:03 +0100	[thread overview]
Message-ID: <Y058a4c549dx50d+@redhat.com> (raw)
In-Reply-To: <20221010133408.3214433-6-nborisov@suse.com>

On Mon, Oct 10, 2022 at 04:34:02PM +0300, Nikolay Borisov wrote:
>  Add a bunch of auxiliarry methods and a feature flag to work with
>  SEEKABLE channels. Currently the only channel considered seekable is
>  QIOChannelFile. Also add a bunch of helper functions to QEMUFile that
>  can make use of this channel feature. All of this is in prepration for
>  supporting 'fixed-ram' migration stream feature.

QIOChannelBuffer/Null are also seekable.

> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
>  include/io/channel.h                |  1 +
>  include/migration/qemu-file-types.h |  2 +
>  io/channel-file.c                   |  5 +++
>  migration/qemu-file.c               | 59 +++++++++++++++++++++++++++++
>  migration/qemu-file.h               |  3 ++
>  5 files changed, 70 insertions(+)

Can you separate the migration/ tree bits into a second patch
that follows the io/ bits.

> 
> diff --git a/include/io/channel.h b/include/io/channel.h
> index c680ee748021..4fc37c78e68c 100644
> --- a/include/io/channel.h
> +++ b/include/io/channel.h
> @@ -41,6 +41,7 @@ enum QIOChannelFeature {
>      QIO_CHANNEL_FEATURE_SHUTDOWN,
>      QIO_CHANNEL_FEATURE_LISTEN,
>      QIO_CHANNEL_FEATURE_WRITE_ZERO_COPY,
> +    QIO_CHANNEL_FEATURE_SEEKABLE,
>  };
>  
>  
> diff --git a/include/migration/qemu-file-types.h b/include/migration/qemu-file-types.h
> index 2867e3da84ab..eb0325ee8687 100644
> --- a/include/migration/qemu-file-types.h
> +++ b/include/migration/qemu-file-types.h
> @@ -50,6 +50,8 @@ unsigned int qemu_get_be16(QEMUFile *f);
>  unsigned int qemu_get_be32(QEMUFile *f);
>  uint64_t qemu_get_be64(QEMUFile *f);
>  
> +bool qemu_file_is_seekable(QEMUFile *f);
> +
>  static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv)
>  {
>      qemu_put_be64(f, *pv);
> diff --git a/io/channel-file.c b/io/channel-file.c
> index da17d0a11ba7..d84a6737f2f7 100644
> --- a/io/channel-file.c
> +++ b/io/channel-file.c
> @@ -35,6 +35,7 @@ qio_channel_file_new_fd(int fd)
>  
>      ioc->fd = fd;
>  
> +    qio_channel_set_feature(QIO_CHANNEL(ioc), QIO_CHANNEL_FEATURE_SEEKABLE);
>      trace_qio_channel_file_new_fd(ioc, fd);
>  
>      return ioc;
> @@ -59,6 +60,10 @@ qio_channel_file_new_path(const char *path,
>          return NULL;
>      }
>  
> +    if (lseek(ioc->fd, 0, SEEK_CUR) != (off_t)-1) {
> +        qio_channel_set_feature(QIO_CHANNEL(ioc), QIO_CHANNEL_FEATURE_SEEKABLE);
> +    }
> +
>      trace_qio_channel_file_new_path(ioc, path, flags, mode, ioc->fd);

Wondering why you do the lseek() sanitytest for only one of the
two constructors ? Shouldn't we do it for both ?




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 :|



  reply	other threads:[~2022-10-18 10:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-10 13:33 [PATCH v2 00/11] Add support for fixed ram offsets during migration Nikolay Borisov
2022-10-10 13:33 ` [PATCH v2 01/11] migration: support file: uri for source migration Nikolay Borisov
2022-10-18  8:56   ` Daniel P. Berrangé
2022-10-18  9:10   ` Daniel P. Berrangé
2022-10-18  9:49     ` Nikolay Borisov
2022-10-10 13:33 ` [PATCH v2 02/11] migration: Add support for 'file:' uri for incoming migration Nikolay Borisov
2022-10-18 10:01   ` Daniel P. Berrangé
2022-10-10 13:34 ` [PATCH v2 03/11] migration: Make migration json writer part of MigrationState struct Nikolay Borisov
2022-10-18 10:06   ` Daniel P. Berrangé
2022-10-19 15:43     ` Nikolay Borisov
2022-10-19 16:02       ` Daniel P. Berrangé
2022-10-10 13:34 ` [PATCH v2 04/11] io: add pwritev support to QIOChannelFile Nikolay Borisov
2022-10-18 10:11   ` Daniel P. Berrangé
2022-10-10 13:34 ` [PATCH v2 05/11] io: Add support for seekable channels Nikolay Borisov
2022-10-18 10:14   ` Daniel P. Berrangé [this message]
2022-10-18 10:46     ` Nikolay Borisov
2022-10-18 10:53       ` Daniel P. Berrangé
2022-10-10 13:34 ` [PATCH v2 06/11] io: Add preadv support to QIOChannelFile Nikolay Borisov
2022-10-10 13:34 ` [PATCH v2 07/11] migration: add qemu_get_buffer_at Nikolay Borisov
2022-10-10 13:34 ` [PATCH v2 08/11] migration/ram: Introduce 'fixed-ram' migration stream capability Nikolay Borisov
2022-10-10 13:34 ` [PATCH v2 09/11] migration: Refactor precopy ram loading code Nikolay Borisov
2022-10-10 13:34 ` [PATCH v2 10/11] migration: Add support for 'fixed-ram' migration restore Nikolay Borisov
2022-10-10 13:34 ` [PATCH v2 11/11] analyze-migration.py: add initial support for fixed ram streams Nikolay Borisov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y058a4c549dx50d+@redhat.com \
    --to=berrange@redhat.com \
    --cc=Claudio.Fontana@suse.com \
    --cc=dfaggioli@suse.com \
    --cc=dgilbert@redhat.com \
    --cc=jfehlig@suse.com \
    --cc=nborisov@suse.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).