1 Star 0 Fork 50

Meredith/grub2

forked from src-anolis-os/grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0195-00_menu_auto_hide-Reduce-number-of-save_env-calls.patch 1.55 KB
一键复制 编辑 原始数据 按行查看 历史
geliwei 提交于 2022-04-13 15:15 . update to grub2-2.02-120.el8.src.rpm
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 27 Jun 2018 13:33:43 +0200
Subject: [PATCH] 00_menu_auto_hide: Reduce number of save_env calls
Normally boot_success will be 1 on every boot (as normally the
previous boot will have been successful). This means that we end
up in the code-path to set boot_indeterminate to 0 every boot.
So we do 2 separate save_env calls each boot, one for boot_indeterminate
and one for boot_success. This results in 2 writes to the disk.
This commit makes us save both boot_success and boot_indeterminate
in a single call, reducing the number of writes, this reducing wear
and tear on the underlying storage.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
util/grub.d/00_menu_auto_hide.in | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/util/grub.d/00_menu_auto_hide.in b/util/grub.d/00_menu_auto_hide.in
index ca95c0d1c..ad175870a 100644
--- a/util/grub.d/00_menu_auto_hide.in
+++ b/util/grub.d/00_menu_auto_hide.in
@@ -19,14 +19,12 @@ fi
# Reset boot_indeterminate after a successful boot
if [ "\${boot_success}" = "1" ] ; then
set boot_indeterminate=0
- save_env boot_indeterminate
# Avoid boot_indeterminate causing the menu to be hidden more then once
elif [ "\${boot_indeterminate}" = "1" ]; then
set boot_indeterminate=2
- save_env boot_indeterminate
fi
set boot_success=0
-save_env boot_success
+save_env boot_success boot_indeterminate
if [ x\$feature_timeout_style = xy ] ; then
if [ "\${menu_show_once}" ]; then
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yueeranna/grub2.git
git@gitee.com:yueeranna/grub2.git
yueeranna
grub2
grub2
a8

搜索帮助

0d507c66 1850385 C8b1a773 1850385