qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block: Fix cache mode defaults in bds_tree_init()
@ 2016-03-07 13:42 Kevin Wolf
  2016-03-07 15:50 ` Eric Blake
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Wolf @ 2016-03-07 13:42 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel, mreitz

Without setting explicit defaults in the options, blockdev-add without
an ID ended up defaulting to writethrough. It should be writeback as
documented.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 blockdev.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/blockdev.c b/blockdev.c
index eecd78d..1824cae 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -675,6 +675,13 @@ static BlockDriverState *bds_tree_init(QDict *bs_opts, Error **errp)
         goto fail;
     }
 
+    /* bdrv_open() defaults to the values in bdrv_flags (for compatibility
+     * with other callers) rather than what we want as the real defaults.
+     * Apply the defaults here instead. */
+    qdict_set_default_str(bs_opts, BDRV_OPT_CACHE_WB, "on");
+    qdict_set_default_str(bs_opts, BDRV_OPT_CACHE_DIRECT, "off");
+    qdict_set_default_str(bs_opts, BDRV_OPT_CACHE_NO_FLUSH, "off");
+
     if (runstate_check(RUN_STATE_INMIGRATE)) {
         bdrv_flags |= BDRV_O_INACTIVE;
     }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] block: Fix cache mode defaults in bds_tree_init()
  2016-03-07 13:42 [Qemu-devel] [PATCH] block: Fix cache mode defaults in bds_tree_init() Kevin Wolf
@ 2016-03-07 15:50 ` Eric Blake
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Blake @ 2016-03-07 15:50 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: qemu-devel, mreitz

[-- Attachment #1: Type: text/plain, Size: 1258 bytes --]

On 03/07/2016 06:42 AM, Kevin Wolf wrote:
> Without setting explicit defaults in the options, blockdev-add without
> an ID ended up defaulting to writethrough. It should be writeback as
> documented.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  blockdev.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

> diff --git a/blockdev.c b/blockdev.c
> index eecd78d..1824cae 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -675,6 +675,13 @@ static BlockDriverState *bds_tree_init(QDict *bs_opts, Error **errp)
>          goto fail;
>      }
>  
> +    /* bdrv_open() defaults to the values in bdrv_flags (for compatibility
> +     * with other callers) rather than what we want as the real defaults.
> +     * Apply the defaults here instead. */
> +    qdict_set_default_str(bs_opts, BDRV_OPT_CACHE_WB, "on");
> +    qdict_set_default_str(bs_opts, BDRV_OPT_CACHE_DIRECT, "off");
> +    qdict_set_default_str(bs_opts, BDRV_OPT_CACHE_NO_FLUSH, "off");
> +
>      if (runstate_check(RUN_STATE_INMIGRATE)) {
>          bdrv_flags |= BDRV_O_INACTIVE;
>      }
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-07 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-07 13:42 [Qemu-devel] [PATCH] block: Fix cache mode defaults in bds_tree_init() Kevin Wolf
2016-03-07 15:50 ` Eric Blake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).