From: Ahmad Fatoum <[email protected]> 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 <[email protected]> --- 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
