block: Make backing files always writeback

First of all, we're generally not writing to backing files, but when we
do, it's in the context of block jobs which know very well when to flush
the image.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Kevin Wolf 2016-03-04 14:52:32 +01:00
parent aaa436f998
commit b8816a4386
2 changed files with 8 additions and 7 deletions

View File

@ -738,8 +738,9 @@ static void bdrv_backing_options(int *child_flags, QDict *child_options,
{ {
int flags = parent_flags; int flags = parent_flags;
/* The cache mode is inherited unmodified for backing files */ /* The cache mode is inherited unmodified for backing files; except WCE,
qdict_copy_default(child_options, parent_options, BDRV_OPT_CACHE_WB); * which is only applied on the top level (BlockBackend) */
qdict_set_default_str(child_options, BDRV_OPT_CACHE_WB, "on");
qdict_copy_default(child_options, parent_options, BDRV_OPT_CACHE_DIRECT); qdict_copy_default(child_options, parent_options, BDRV_OPT_CACHE_DIRECT);
qdict_copy_default(child_options, parent_options, BDRV_OPT_CACHE_NO_FLUSH); qdict_copy_default(child_options, parent_options, BDRV_OPT_CACHE_NO_FLUSH);

View File

@ -62,7 +62,7 @@ cache.direct=on on backing-file
cache.writeback=off on none0 cache.writeback=off on none0
Cache mode: writethrough Cache mode: writethrough
Cache mode: writeback Cache mode: writeback
Cache mode: writethrough Cache mode: writeback
Cache mode: writeback Cache mode: writeback
cache.writeback=off on file cache.writeback=off on file
@ -143,7 +143,7 @@ cache.writeback=off on none0
Cache mode: writethrough Cache mode: writethrough
Cache mode: writethrough Cache mode: writethrough
Cache mode: writeback Cache mode: writeback
Cache mode: writethrough Cache mode: writeback
Cache mode: writeback Cache mode: writeback
cache.writeback=off on file cache.writeback=off on file
@ -302,7 +302,7 @@ cache.direct=on on backing-file
cache.writeback=off on none0 cache.writeback=off on none0
Cache mode: writethrough, direct Cache mode: writethrough, direct
Cache mode: writeback, direct Cache mode: writeback, direct
Cache mode: writethrough, direct Cache mode: writeback, direct
Cache mode: writeback, direct Cache mode: writeback, direct
cache.writeback=off on file cache.writeback=off on file
@ -383,7 +383,7 @@ cache.writeback=off on none0
Cache mode: writeback, direct Cache mode: writeback, direct
Cache mode: writethrough Cache mode: writethrough
Cache mode: writeback Cache mode: writeback
Cache mode: writethrough Cache mode: writeback
Cache mode: writeback Cache mode: writeback
cache.writeback=off on file cache.writeback=off on file
@ -718,7 +718,7 @@ cache.direct=on on backing-file
cache.writeback=off on none0 cache.writeback=off on none0
Cache mode: writethrough Cache mode: writethrough
Cache mode: writeback Cache mode: writeback
Cache mode: writethrough, direct Cache mode: writeback, direct
Cache mode: writeback, direct Cache mode: writeback, direct
cache.writeback=off on file cache.writeback=off on file