1 Star 0 Fork 121

liksh/qemu

forked from src-openEuler/qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
migration-skip-cache_drop-for-bios-bootloader-and-nv.patch 1.79 KB
一键复制 编辑 原始数据 按行查看 历史
Jiabo Feng 提交于 2024-04-07 10:21 . QEMU update to version 8.2.0-5
From dfb9372702b2fb994392b8a6e8a39964c2656ae6 Mon Sep 17 00:00:00 2001
From: Chuan Zheng <zhengchuan@huawei.com>
Date: Wed, 9 Feb 2022 08:49:41 +0800
Subject: [PATCH] migration: skip cache_drop for bios bootloader and nvram
template
Qemu enabled page cache dropping for raw device on the destionation host
during shared storage migration.
However, fsync may take 300ms to multiple seconds to return in multiple-migration
scene, because all domains in a host share bios bootloader file, skip cache_drop
for bios bootloader and nvram template to avoid downtime increase.
---
block.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/block.c b/block.c
index b7cb963929..3bfd4be6b4 100644
--- a/block.c
+++ b/block.c
@@ -68,6 +68,9 @@
#define NOT_DONE 0x7fffffff /* used while emulated sync operation in progress */
+#define DEFAULT_BIOS_BOOT_LOADER_DIR "/usr/share/edk2"
+#define DEFAULT_NVRAM_TEMPLATE_DIR "/var/lib/libvirt/qemu/nvram"
+
/* Protected by BQL */
static QTAILQ_HEAD(, BlockDriverState) graph_bdrv_states =
QTAILQ_HEAD_INITIALIZER(graph_bdrv_states);
@@ -7017,7 +7020,13 @@ int coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs, Error **errp)
assert(!(bs->open_flags & BDRV_O_INACTIVE));
assert_bdrv_graph_readable();
- if (bs->drv->bdrv_co_invalidate_cache) {
+ /*
+ * It's not necessary for bios bootloader and nvram template to drop cache
+ * when migration, skip this step for them to avoid dowtime increase.
+ */
+ if (bs->drv->bdrv_co_invalidate_cache &&
+ !strstr(bs->filename, DEFAULT_BIOS_BOOT_LOADER_DIR) &&
+ !strstr(bs->filename, DEFAULT_NVRAM_TEMPLATE_DIR)) {
bs->drv->bdrv_co_invalidate_cache(bs, &local_err);
if (local_err) {
error_propagate(errp, local_err);
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liksh/qemu.git
git@gitee.com:liksh/qemu.git
liksh
qemu
qemu
master

搜索帮助