dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0195-00_menu_auto_hide-Reduce-number-of-save_env-calls.patch

8631a2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8631a2
From: Hans de Goede <hdegoede@redhat.com>
8631a2
Date: Wed, 27 Jun 2018 13:33:43 +0200
8631a2
Subject: [PATCH] 00_menu_auto_hide: Reduce number of save_env calls
8631a2
8631a2
Normally boot_success will be 1 on every boot (as normally the
8631a2
previous boot will have been successful). This means that we end
8631a2
up in the code-path to set boot_indeterminate to 0 every boot.
8631a2
8631a2
So we do 2 separate save_env calls each boot, one for boot_indeterminate
8631a2
and one for boot_success. This results in 2 writes to the disk.
8631a2
8631a2
This commit makes us save both boot_success and boot_indeterminate
8631a2
in a single call, reducing the number of writes, this reducing wear
8631a2
and tear on the underlying storage.
8631a2
8631a2
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
8631a2
---
8631a2
 util/grub.d/00_menu_auto_hide.in | 4 +---
8631a2
 1 file changed, 1 insertion(+), 3 deletions(-)
8631a2
8631a2
diff --git a/util/grub.d/00_menu_auto_hide.in b/util/grub.d/00_menu_auto_hide.in
8631a2
index ca95c0d1c9f..ad175870a54 100644
8631a2
--- a/util/grub.d/00_menu_auto_hide.in
8631a2
+++ b/util/grub.d/00_menu_auto_hide.in
8631a2
@@ -19,14 +19,12 @@ fi
8631a2
 # Reset boot_indeterminate after a successful boot
8631a2
 if [ "\${boot_success}" = "1" ] ; then
8631a2
   set boot_indeterminate=0
8631a2
-  save_env boot_indeterminate
8631a2
 # Avoid boot_indeterminate causing the menu to be hidden more then once
8631a2
 elif [ "\${boot_indeterminate}" = "1" ]; then
8631a2
   set boot_indeterminate=2
8631a2
-  save_env boot_indeterminate
8631a2
 fi
8631a2
 set boot_success=0
8631a2
-save_env boot_success
8631a2
+save_env boot_success boot_indeterminate
8631a2
 
8631a2
 if [ x\$feature_timeout_style = xy ] ; then
8631a2
   if [ "\${menu_show_once}" ]; then