From 72e775c7d9de3eaa35a6edaf9d87cedee149d0f5 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Tue, 15 Mar 2016 14:34:37 +0100 Subject: block: Always set writeback mode in blk_new_open() All callers of blk_new_open() either don't rely on the WCE bit set after blk_new_open() because they explicitly set it anyway, or they pass BDRV_O_CACHE_WB unconditionally. This patch changes blk_new_open() so that it always enables writeback mode and asserts that BDRV_O_CACHE_WB is clear. For those callers that used to pass BDRV_O_CACHE_WB unconditionally, the flag is removed now. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- blockdev.c | 1 + 1 file changed, 1 insertion(+) (limited to 'blockdev.c') diff --git a/blockdev.c b/blockdev.c index b65891382b..00a77dc750 100644 --- a/blockdev.c +++ b/blockdev.c @@ -598,6 +598,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, qdict_set_default_str(bs_opts, BDRV_OPT_CACHE_WB, writethrough ? "off" : "on"); qdict_set_default_str(bs_opts, BDRV_OPT_CACHE_DIRECT, "off"); qdict_set_default_str(bs_opts, BDRV_OPT_CACHE_NO_FLUSH, "off"); + assert((bdrv_flags & BDRV_O_CACHE_MASK) == 0); if (runstate_check(RUN_STATE_INMIGRATE)) { bdrv_flags |= BDRV_O_INACTIVE; -- cgit v1.2.3-55-g7522