[libvirt] [PATCHv2 11/16] save: let iohelper work on O_DIRECT fds
Daniel P. Berrange
berrange at redhat.com
Thu Jul 21 11:32:14 UTC 2011
On Tue, Jul 19, 2011 at 10:20:34PM -0600, Eric Blake wrote:
> Required for a coming patch where iohelper will operate on O_DIRECT
> fds. There, the user-space memory must be aligned to file system
> boundaries (at least 512, but using page-aligned works better, and
> some file systems prefer 64k). Made tougher by the fact that
> VIR_ALLOC won't work on void *, but posix_memalign won't work on
> char * and isn't available everywhere.
>
> This patch makes some simplifying assumptions - namely, output
> to an O_DIRECT fd will only be attempted on an empty seekable
> file (hence, no need to worry about preserving existing data
> on a partial block, and ftruncate will work to undo the effects
> of having to round up the size of the last block written), and
> input from an O_DIRECT fd will only be attempted on a complete
> seekable file with the only possible short read at EOF.
>
> * configure.ac (AC_CHECK_FUNCS_ONCE): Check for posix_memalign.
> * src/util/iohelper.c (runIO): Use aligned memory, and handle
> quirks of O_DIRECT on last write.
> ---
>
> v2: merge patch 6 and 15 of v1.
> Sorry, I didn't add a testsuite of this yet, but agree that
> it would be a nice project
>
> configure.ac | 6 ++--
> src/util/iohelper.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++--
> 2 files changed, 52 insertions(+), 6 deletions(-)
ACK
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