On 07/19/2011 10:10 AM, Daniel P. Berrange wrote:
On Thu, Jul 14, 2011 at 08:24:28AM -0600, Eric Blake wrote:
> In order to choose whether to use O_DIRECT when saving a domain image
> to a file, we need a new flag. But virDomainSave was implemented
> before our policy of all new APIs having a flag argument.
>
> * include/libvirt/libvirt.h.in (virDomainSaveFlags): New prototype.
> * src/libvirt.c (virDomainSaveFlags): New API.
> * src/libvirt_public.syms: Export it.
> * src/driver.h (virDrvDomainSaveFlags): New driver callback.
> ---
> include/libvirt/libvirt.h.in | 14 ++++++
> src/driver.h | 6 +++
> src/libvirt.c | 94 +++++++++++++++++++++++++++++++++++++++++-
> src/libvirt_public.syms | 5 ++
> 4 files changed, 118 insertions(+), 1 deletions(-)
>
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index d5a7105..d9a8694 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -659,6 +659,7 @@ typedef virDomainMemoryStatStruct *virDomainMemoryStatPtr;
> typedef enum {
> VIR_DUMP_CRASH = (1<< 0), /* crash after dump */
> VIR_DUMP_LIVE = (1<< 1), /* live dump */
> + VIR_DUMP_DIRECT = (1<< 2), /* Use O_DIRECT while saving */
I wonder if we're better off calling this 'BYPASS_CACHE' or something
like since, since O_DIRECT is just an impl detail.
Absolutely a good idea! I'll fold that rename into v2, particularly
since, if posix_fadvise ever gets smarter on Linux, then we can bypass
the cache without using O_DIRECT.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org