efi_disk_add_dev() runs efi_fs_exists() on every GPT partition as
soon as its block device probes, even for raw partitions that are
never opened as a filesystem before boot. Only the ESP needs this
probe for boot, so skip it for other GPT partitions.

~170ms saved on Qcom SoC bootup time.

Signed-off-by: Aswin Murugan <[email protected]>
---
 lib/efi_loader/efi_disk.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index 4a3ace3a304..4fd53fb598a 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -529,8 +529,12 @@ static efi_status_t efi_disk_add_dev(
        /*
         * On partitions or whole disks without partitions install the
         * simple file system protocol if a file system is available.
+        *
+        * Skip the filesystem probe for non-ESP GPT partitions: only the ESP
+        * is ever opened as a filesystem before boot.
         */
        if ((part || desc->part_type == PART_TYPE_UNKNOWN) &&
+           (!part_info || (part_info->bootable & PART_EFI_SYSTEM_PARTITION)) &&
            efi_fs_exists(desc, part)) {
                ret = efi_create_simple_file_system(desc, part, diskobj->dp,
                                                    &diskobj->volume);
-- 
2.34.1

Reply via email to