[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 15/8] save: add more iohelper support for O_DIRECT



On Fri, Jul 15, 2011 at 08:48:18PM -0600, Eric Blake wrote:
> Constraining the problem makes the solution easier to think about.
> 
> * src/util/iohelper.c (runIO): Make read support easy.
> ---
> 
> Could be squashed into 6/8.
> 
>  src/util/iohelper.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/src/util/iohelper.c b/src/util/iohelper.c
> index 82f62e1..f091d13 100644
> --- a/src/util/iohelper.c
> +++ b/src/util/iohelper.c
> @@ -107,6 +107,13 @@ runIO(const char *path, int fd, int oflags, unsigned long long length)
>          fdinname = path;
>          fdout = STDOUT_FILENO;
>          fdoutname = "stdout";
> +        /* To make the implementation simpler, we give up on any
> +         * attempt to use O_DIRECT in a non-trivial manner.  */
> +        if (direct && ((end = lseek(fd, 0, SEEK_CUR)) != 0 || length)) {
> +            virReportSystemError(end < 0 ? errno : EINVAL, "%s",
> +                                 _("O_DIRECT read needs entire seekable file"));
> +            goto cleanup;
> +        }
>          break;
>      case O_WRONLY:
>          fdin = STDIN_FILENO;
> @@ -117,7 +124,7 @@ runIO(const char *path, int fd, int oflags, unsigned long long length)
>           * attempt to use O_DIRECT in a non-trivial manner.  */
>          if (direct && (end = lseek(fd, 0, SEEK_END)) != 0) {
>              virReportSystemError(end < 0 ? errno : EINVAL, "%s",
> -                                 _("O_DIRECT needs empty seekable file"));
> +                                 _("O_DIRECT write needs empty seekable file"));
>              goto cleanup;
>          }
>          break;

ACK, if this really works for saving guests. We need to skip over the
initial header + XML in save files, so I would have thought we needed
to support a non-empty seekable file.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]