qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <Laurent.Vivier@bull.net>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@suse.de>
Subject: Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT)
Date: Tue, 29 Apr 2008 11:01:07 +0200	[thread overview]
Message-ID: <1209459667.4328.7.camel@frecb07144> (raw)
In-Reply-To: <4815EE89.70407@suse.de>


Le lundi 28 avril 2008 à 17:34 +0200, Kevin Wolf a écrit :
> Kevin Wolf schrieb:
> > In December a patch was applied which introduced the cache=off option to
> > -drive. When using this option files are opened with the O_DIRECT flag.
> > This means that all accesses have to be aligned. The patch made a couple
> > of changes in this respect, still in other places they are missing (e.g.
> > you can't use cache=off with qcow(2) files).
> > 
> > This patch implements wrappers for raw_pread and raw_pwrite which align
> > all file accesses and make qcow(2) work with cache=off. This method
> > might not be the most performant one (compared to fixing qcow, qcow2 and
> > everything else that might be using unaligned accesses), but unaligned
> > accesses don't happen that frequently and with this patch really all
> > image accesses should be covered.
> > 
> > Signed-off-by: Kevin Wolf <kwolf@suse.de>
> 
> Anything wrong with this one?

Hi Kevin,

I did a patch to manage this problem too:

http://thread.gmane.org/gmane.comp.emulators.qemu/22881

What I like in your patch:
- simplicity
What I don't like in your patch:
- memcpy() and memalign()

What I like in my patch:
- no memcpy()
What I don't like in my patch:
- complexity

But if we want too keep simplicity without memcpy(), we could only
de-activate O_DIRECT on pread() or pwrite() :

 fd_arg = fcntl(fd, F_GETFL);
 if ((fd_arg & O_DIRECT) == 0)
     return 0;
 fcntl(fd, F_SETFL, fd_arg & ~O_DIRECT);

And restore it after.

Regards,
Laurent
-- 
------------- Laurent.Vivier@bull.net ---------------
"The best way to predict the future is to invent it."
- Alan Kay

  reply	other threads:[~2008-04-29  9:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-17 13:31 [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT) Kevin Wolf
2008-04-28 15:34 ` Kevin Wolf
2008-04-29  9:01   ` Laurent Vivier [this message]
2008-04-29 14:49     ` Kevin Wolf
2008-04-29 15:48       ` Laurent Vivier
2008-04-29 16:21         ` Kevin Wolf
2008-04-29 16:48           ` Laurent Vivier
2008-04-30  9:21             ` Kevin Wolf
2008-04-30  9:59               ` Laurent Vivier
2008-04-30 12:08                 ` Kevin Wolf
2008-04-30 14:30                   ` Blue Swirl
2008-04-30 21:05                     ` Kevin Wolf
2008-05-01 14:35                       ` Blue Swirl
2008-05-01 17:55                         ` Kevin Wolf
2008-05-06  8:44                           ` Kevin Wolf
2008-05-06  9:02                             ` Laurent Vivier
2008-05-06 16:42                             ` Blue Swirl
2008-05-06 16:56                               ` Kevin Wolf
2008-05-06 17:23                                 ` Blue Swirl
2008-04-30  0:05           ` Jamie Lokier
2008-04-30  0:02       ` Jamie Lokier

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=1209459667.4328.7.camel@frecb07144 \
    --to=laurent.vivier@bull.net \
    --cc=kwolf@suse.de \
    --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).