]> git.ipfire.org Git - thirdparty/libvirt.git/commit
save: let iohelper work on O_DIRECT fds
authorEric Blake <eblake@redhat.com>
Tue, 12 Jul 2011 14:35:05 +0000 (08:35 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 21 Jul 2011 22:24:08 +0000 (16:24 -0600)
commit12291656b135ed788e41dadbd2d15e613ddea9b5
tree048c2a709fd9627b91e3e1fd3405569bd8ab7559
parent1eb6647979f8c657958069a28df713deab3052a6
save: let iohelper work on O_DIRECT fds

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.
configure.ac
src/util/iohelper.c