
On Tue, Jul 19, 2011 at 10:20:35PM -0600, Eric Blake wrote:
O_DIRECT has stringent requirements. Rather than make lots of changes at each site that wants to use O_DIRECT, it is easier to offload the work through a helper process that mirrors the I/O between a pipe and the actual direct fd, so that the other end of the pipe no longer has to worry about constraints.
Plus, if the kernel ever gains better posix_fadvise support, then we only have to touch a single file to let all callers benefit from a more efficient way to avoid file system caching.
* src/util/virfile.h (virFileDirectFdFlag, virFileDirectFdNew) (virFileDirectFdClose, virFileDirectFdFree): New prototypes. * src/util/virdirect.c: Implement new wrapper object. * src/libvirt_private.syms (virfile.h): Export new symbols. * cfg.mk (useless_free_options): Add to list. * po/POTFILES.in: Add new translations. ---
v2: move everything into virfile.c rather than creating a new file, with renames everywhere. Fail rather than silently ignore systems where O_DIRECT is 0. Add comments to take advantage of posix_fadvise rather than O_DIRECT if the Linux kernel ever gets fixed. Add virFileDirectFdFlag as a better probe of which cache-bypass mechanism is actually being used. Better documentation.
cfg.mk | 1 + po/POTFILES.in | 1 + src/libvirt_private.syms | 4 + src/util/virfile.c | 175 +++++++++++++++++++++++++++++++++++++++++++++- src/util/virfile.h | 15 ++++ 5 files changed, 195 insertions(+), 1 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 :|