* [PATCH] efi: loader: disk: detect the file system type only once
@ 2026-08-31 14:55 Ahmad Fatoum
2026-09-02 8:33 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-08-31 14:55 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum, Ahmad Fatoum
From: Ahmad Fatoum <a.fatoum@barebox.org>
efi_fs_exists() calls cdev_detect_type() once per file system driver,
reading the first FILE_TYPE_SAFE_BUFSIZE bytes off the device each time.
Run cdev_detect_type() once and then match the result against the drivers.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
efi/loader/protocols/disk.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/efi/loader/protocols/disk.c b/efi/loader/protocols/disk.c
index 5376c9ec9a14..493be8c5aafe 100644
--- a/efi/loader/protocols/disk.c
+++ b/efi/loader/protocols/disk.c
@@ -160,16 +160,14 @@ efi_fs_from_path(struct efi_device_path *full_path)
static bool efi_fs_exists(struct cdev *cdev)
{
+ enum filetype filetype;
struct driver *drv;
+ if (cdev_detect_type(cdev, &filetype))
+ return false;
+
bus_for_each_driver(&fs_bus, drv) {
- struct fs_driver *fdrv;
- enum filetype filetype;
-
- fdrv = drv_to_fs_driver(drv);
-
- if (cdev_detect_type(cdev, &filetype) == 0 &&
- filetype == fdrv->type)
+ if (drv_to_fs_driver(drv)->type == filetype)
return true;
}
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] efi: loader: disk: detect the file system type only once
2026-08-31 14:55 [PATCH] efi: loader: disk: detect the file system type only once Ahmad Fatoum
@ 2026-09-02 8:33 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2026-09-02 8:33 UTC (permalink / raw)
To: barebox, Ahmad Fatoum; +Cc: Ahmad Fatoum
On Mon, 31 Aug 2026 16:55:23 +0200, Ahmad Fatoum wrote:
> efi_fs_exists() calls cdev_detect_type() once per file system driver,
> reading the first FILE_TYPE_SAFE_BUFSIZE bytes off the device each time.
> Run cdev_detect_type() once and then match the result against the drivers.
>
>
Applied, thanks!
[1/1] efi: loader: disk: detect the file system type only once
https://git.pengutronix.de/cgit/barebox/commit/?id=d7cb6c249960 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-02 8:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-31 14:55 [PATCH] efi: loader: disk: detect the file system type only once Ahmad Fatoum
2026-09-02 8:33 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox