commit:     5dbad2e10c32043f90e6507438d93c9a9d480e07
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 25 13:40:42 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Nov 25 13:40:42 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=5dbad2e1

initrd.scripts: modules_scan(): Disable smart module loading when root needs an 
external program

When using dolvm or domdadm for example, root won't be available until lvm
program scanned for volumes and made them available or mdadm program was
called to assemble RAID.
So checking for root block device after each module was loaded won't save
us any time instead will just waste time.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/initrd.scripts | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 561788d..c19701c 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -53,17 +53,17 @@ modules_scan() {
                # We don't know if kernel supports root filesystem so
                # better load all filesystems ...
                smart_loading=
-       elif [ -n "${CRYPT_ROOT}" ] || [ -n "${CRYPT_SWAP}" ]
-       then
-               if [ "${1}" = "crypto" ]
-               then
-                       smart_loading=
-               elif [ "${1}" = "usb" ]
-               then
-                       # We don't know if user is using an USB keyboard to
-                       # enter passphrase so better load USB ...
-                       smart_loading=
-               fi
+       elif [ "${USE_MDADM}" = '1' ] \
+               || [ "${USE_LVM_NORMAL}" = '1' ] \
+               || [ "${USE_CRYPTSETUP}" = '1' ] \
+               || [ "${USE_BTRFS}" = '1' ] \
+               || [ "${USE_ZFS}" = '1' ] \
+               || [ "${USE_DMRAID_NORMAL}" = '1' ]
+       then
+               # All of this will require the call of another program before
+               # root becomes available so checking for root after each module
+               # was loaded will only waste time.
+               smart_loading=
        fi
 
        MODS=$(cat /etc/modules/${1} 2>/dev/null)

Reply via email to