From 082dd257af9d43bbecd8e35c97fbb451c6db607f Mon Sep 17 00:00:00 2001 From: xiaoyuliang Date: Thu, 1 Aug 2024 15:59:23 +0800 Subject: [PATCH] block: Undo enable cache mode of empty cdrom to fix blockdev_init assert failed --- blockdev.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/blockdev.c b/blockdev.c index bc7a947dea..e66e0b8a50 100644 --- a/blockdev.c +++ b/blockdev.c @@ -496,7 +496,6 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, QDict *interval_dict = NULL; QList *interval_list = NULL; const char *id; - const char *cache; BlockdevDetectZeroesOptions detect_zeroes = BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF; const char *throttling_group = NULL; @@ -588,21 +587,6 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, read_only = qemu_opt_get_bool(opts, BDRV_OPT_READ_ONLY, false); - if (!file || !*file) { - cache = qdict_get_try_str(bs_opts, BDRV_OPT_CACHE_NO_FLUSH); - if (cache && !strcmp(cache, "on")) { - bdrv_flags |= BDRV_O_NO_FLUSH; - } - - cache = qdict_get_try_str(bs_opts, BDRV_OPT_CACHE_DIRECT); - if (cache && !strcmp(cache, "on")) { - bdrv_flags |= BDRV_O_NOCACHE; - } - - qdict_del(bs_opts, BDRV_OPT_CACHE_NO_FLUSH); - qdict_del(bs_opts, BDRV_OPT_CACHE_DIRECT); - } - /* init */ if ((!file || !*file) && !qdict_size(bs_opts)) { BlockBackendRootState *blk_rs; -- Gitee