aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-03-18 15:35:51 +0100
committerKevin Wolf <kwolf@redhat.com>2016-03-30 12:16:02 +0200
commit04feb4a5073e75b8ed213b297c857fa3ccc0b538 (patch)
tree9b3faf2b71f32cd8c8104436deb31b69d4a3860f
parent5481531154cf08ed53623a0184f7677a9b98d083 (diff)
downloadqemu-04feb4a5073e75b8ed213b297c857fa3ccc0b538.zip
qemu-04feb4a5073e75b8ed213b297c857fa3ccc0b538.tar.gz
qemu-04feb4a5073e75b8ed213b297c857fa3ccc0b538.tar.bz2
block: Use bdrv_parse_cache_mode() in drive_init()
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
-rw-r--r--blockdev.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/blockdev.c b/blockdev.c
index 00a77dc..7a73726 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -899,8 +899,9 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
value = qemu_opt_get(all_opts, "cache");
if (value) {
int flags = 0;
+ bool writethrough;
- if (bdrv_parse_cache_flags(value, &flags) != 0) {
+ if (bdrv_parse_cache_mode(value, &flags, &writethrough) != 0) {
error_report("invalid cache option");
return NULL;
}
@@ -908,7 +909,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
/* Specific options take precedence */
if (!qemu_opt_get(all_opts, BDRV_OPT_CACHE_WB)) {
qemu_opt_set_bool(all_opts, BDRV_OPT_CACHE_WB,
- !!(flags & BDRV_O_CACHE_WB), &error_abort);
+ !writethrough, &error_abort);
}
if (!qemu_opt_get(all_opts, BDRV_OPT_CACHE_DIRECT)) {
qemu_opt_set_bool(all_opts, BDRV_OPT_CACHE_DIRECT,