[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



On Thu, Jul 14, 2011 at 08:24:34AM -0600, Eric Blake wrote:
> O_DIRECT has stringent requirements - I/O must occur with buffers
> that have both alignment and size as multiples of the file system
> block size (used to be 512 bytes, but these days, 4k is safer, and
> 64k allows for better throughput).  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.
> 
> * src/util/virdirect.h: New file.
> * src/util/virdirect.c: Likewise.
> * src/Makefile.am (UTIL_SOURCES): Build them.
> * src/libvirt_private.syms: Export new symbols.
> * cfg.mk (useless_free_options): Add to list.
> * po/POTFILES.in: Translate new file.
> ---
>  cfg.mk                   |    1 +
>  po/POTFILES.in           |    1 +
>  src/Makefile.am          |    1 +
>  src/libvirt_private.syms |    6 ++
>  src/util/virdirect.c     |  149 ++++++++++++++++++++++++++++++++++++++++++++++
>  src/util/virdirect.h     |   37 +++++++++++
>  6 files changed, 195 insertions(+), 0 deletions(-)
>  create mode 100644 src/util/virdirect.c
>  create mode 100644 src/util/virdirect.h
> 
> diff --git a/cfg.mk b/cfg.mk
> index 2873177..69d2b6a 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -97,6 +97,7 @@ useless_free_options =				\
>    --name=virCommandFree				\
>    --name=virConfFreeList			\
>    --name=virConfFreeValue			\
> +  --name=virDirectFdFree			\
>    --name=virDomainChrDefFree			\
>    --name=virDomainChrSourceDefFree		\
>    --name=virDomainControllerDefFree		\
> diff --git a/po/POTFILES.in b/po/POTFILES.in
> index 5782cbf..ad031f3 100644
> --- a/po/POTFILES.in
> +++ b/po/POTFILES.in
> @@ -122,6 +122,7 @@ src/util/storage_file.c
>  src/util/sysinfo.c
>  src/util/util.c
>  src/util/viraudit.c
> +src/util/virdirect.c
>  src/util/virterror.c
>  src/util/xml.c
>  src/vbox/vbox_MSCOMGlue.c
> diff --git a/src/Makefile.am b/src/Makefile.am
> index d19d1ca..ce041b4 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -80,6 +80,7 @@ UTIL_SOURCES =							\
>  		util/uuid.c util/uuid.h				\
>  		util/util.c util/util.h				\
>  		util/viraudit.c util/viraudit.h			\
> +		util/virdirect.c util/virdirect.h		\
>  		util/xml.c util/xml.h				\
>  		util/virterror.c util/virterror_internal.h
> 
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index f95d341..c78485d 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -1085,6 +1085,12 @@ virAuditOpen;
>  virAuditSend;
> 
> 
> +# virdirect.h
> +virDirectFdClose;
> +virDirectFdFree;
> +virDirectFdNew;

The principle all seems fine, but I'm wondering about the naming of
this. Also perhaps we could put this in the files.h module ? It would
be nice to eventually move all virFile named APIs into there and perhaps
even rename it to virfile.{c,h}


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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]