[libvirt] [PATCH 7/8] save: add virDirectFd wrapper type

Daniel P. Berrange berrange at redhat.com
Tue Jul 19 16:22:00 UTC 2011


On Tue, Jul 19, 2011 at 10:08:21AM -0600, Eric Blake wrote:
> On 07/19/2011 10:06 AM, Daniel P. Berrange wrote:
> >
> >The motivation for using O_DIRECT is that allowing pollution of the
> >host cache causes stability problems for the host as a whole. As
> >such IMHO, apps would likely want an error back if O_DIRECT cannot
> >be supported,
> >
> >NB, even some Linux filesystems can't do O_DIRECT, so this isn't an
> >obscure mingw32 issue.
> 
> Conversely, open() on Linux silently ignores unknown flags - so if
> you are using a really old kernel but newer glibc headers, then
> O_DIRECT is non-zero and open() succeeds, but you _don't_ get direct
> I/O.
> 
> If O_DIRECT is 0, then it is pretty easy to diagnose that the
> request is unsupported.  But if O_DIRECT is non-zero, then how do I
> tell whether the open(O_DIRECT) really meant that I have direct I/O,
> or whether it was a nice hint but still ignored and I'm still
> polluting the file system cache?

Hmm, I could have sworn we've seen QEMU itself fail to start when
requesting O_DIRECT on say, tmpfs. Perhaps open() isn't failing,
but rather read/write fail ?

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




More information about the libvir-list mailing list