[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT)
From: |
Laurent Vivier |
Subject: |
Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT) |
Date: |
Tue, 29 Apr 2008 11:01:07 +0200 |
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 <address@hidden>
>
> 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
--
------------- address@hidden ---------------
"The best way to predict the future is to invent it."
- Alan Kay
- [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT), Kevin Wolf, 2008/04/17
- Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT), Kevin Wolf, 2008/04/28
- Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT),
Laurent Vivier <=
- Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT), Kevin Wolf, 2008/04/29
- Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT), Laurent Vivier, 2008/04/29
- Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT), Kevin Wolf, 2008/04/29
- Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT), Laurent Vivier, 2008/04/29
- Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT), Kevin Wolf, 2008/04/30
- Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT), Laurent Vivier, 2008/04/30
- Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT), Kevin Wolf, 2008/04/30
- Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT), Blue Swirl, 2008/04/30
- Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT), Kevin Wolf, 2008/04/30
- Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT), Jamie Lokier, 2008/04/29