From: Michael Chang via Grub-devel <grub-devel@gnu.org>
To: The development of GNU GRUB <grub-devel@gnu.org>
Cc: Michael Chang <mchang@suse.com>
Subject: [PATCH] disk: Prioritize OS disk devices over memdisk and procfs
Date: Fri, 15 Mar 2024 17:00:28 +0800 [thread overview]
Message-ID: <20240315090028.32516-1-mchang@suse.com> (raw)
Refine iteration to prioritize returning system disk devices over
memdisk and procfs. This adjustment brings about a modest improvement in
search efficiency, particularly during file or UUID-based
searches for a root file system. Additionally, it helps mitigate
potential collisions in file-based searches where memdisk may mistakenly
take precedence over system disks.
Signed-off-by: Michael Chang <mchang@suse.com>
---
include/grub/disk.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/grub/disk.h b/include/grub/disk.h
index fbf23df7f..b3e4f1c8b 100644
--- a/include/grub/disk.h
+++ b/include/grub/disk.h
@@ -242,7 +242,12 @@ grub_disk_dev_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data)
for (pull = 0; pull < GRUB_DISK_PULL_MAX; pull++)
for (p = grub_disk_dev_list; p; p = p->next)
- if (p->disk_iterate && (p->disk_iterate) (hook, hook_data, pull))
+ if ((p->id != GRUB_DISK_DEVICE_MEMDISK_ID && p->id != GRUB_DISK_DEVICE_PROCFS_ID) && p->disk_iterate && (p->disk_iterate) (hook, hook_data, pull))
+ return 1;
+
+ for (pull = 0; pull < GRUB_DISK_PULL_MAX; pull++)
+ for (p = grub_disk_dev_list; p; p = p->next)
+ if ((p->id == GRUB_DISK_DEVICE_MEMDISK_ID || p->id == GRUB_DISK_DEVICE_PROCFS_ID) && p->disk_iterate && (p->disk_iterate) (hook, hook_data, pull))
return 1;
return 0;
--
2.44.0
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
next reply other threads:[~2024-03-15 9:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-15 9:00 Michael Chang via Grub-devel [this message]
2024-03-15 15:09 ` [PATCH] disk: Prioritize OS disk devices over memdisk and procfs Daniel Kiper
2024-03-18 6:21 ` Michael Chang via Grub-devel
2024-03-18 11:34 ` Daniel Kiper
2024-03-19 9:34 ` Michael Chang via Grub-devel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240315090028.32516-1-mchang@suse.com \
--to=grub-devel@gnu.org \
--cc=mchang@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).