qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [v7 Patch 4/5]Qemu: Add commandline -drive option 'host


From: Kevin Wolf
Subject: Re: [Qemu-devel] [v7 Patch 4/5]Qemu: Add commandline -drive option 'hostcache'
Date: Wed, 12 Oct 2011 16:30:45 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0) Gecko/20110927 Thunderbird/7.0

Am 11.10.2011 05:11, schrieb Supriya Kannery:
> qemu command option 'hostcache' added to -drive for block devices.
> While starting a VM from qemu commandline, this option can be used 
> for setting host cache usage for block data access. Simultaneous
> use of 'hostcache' and 'cache' options not allowed.
> 
> Signed-off-by: Supriya Kannery <address@hidden>

I'm not sure if introducing this alone makes sense. I think I would only
do it when we introduce more options that allow replacing all cache=...
options by other parameters.

> 
> ---
>  blockdev.c      |   13 +++++++++++++
>  qemu-config.c   |    4 ++++
>  qemu-options.hx |    2 +-
>  3 files changed, 18 insertions(+), 1 deletion(-)
> 
> Index: qemu/blockdev.c
> ===================================================================
> --- qemu.orig/blockdev.c
> +++ qemu/blockdev.c
> @@ -237,6 +237,7 @@ DriveInfo *drive_init(QemuOpts *opts, in
>      DriveInfo *dinfo;
>      int snapshot = 0;
>      int ret;
> +    int hostcache = 0;
>  
>      translation = BIOS_ATA_TRANSLATION_AUTO;
>      media = MEDIA_DISK;
> @@ -319,7 +320,19 @@ DriveInfo *drive_init(QemuOpts *opts, in
>       }
>      }
>  
> +    if ((hostcache = qemu_opt_get_bool(opts, "hostcache", -1)) != -1) {
> +        if (!hostcache) {
> +            bdrv_flags |= BDRV_O_NOCACHE;
> +        } else {
> +            bdrv_flags &= ~BDRV_O_NOCACHE;
> +        }

bdrv_flags is initialised to 0, so the else branch is unnecessary.

Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]