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 <supri...@linux.vnet.ibm.com>
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