On 2025-09-16 17:33, [email protected] wrote:
Message: 3
Date: Tue, 16 Sep 2025 14:38:05 +0800
From: Michael Chang <[email protected]>
To: The development of GNU GRUB <[email protected]>
Subject: [PATCH] getroot: Skip mount points in grub_find_device
Message-ID: <[email protected]>
The grub_find_device function scans a starting directory, typically
/dev, for device files with matching major and minor numbers. During
this process, it recursively descends into subdirectories.
However, this can significantly slow down the scan if a subdirectory is
a mount point not related to devtmpfs, especially if it contains a
large
number of files.
This patch modifies grub_find_device() to skip subdirectories that are
mount points. A mount point is detected by comparing the st_dev of the
subdirectory against that of the parent or starting directory. While
this method does not catch all types of mounts, for eg bind mounts, it
is a practical solution that avoids the need to parse
/proc/self/mounts.
Signed-off-by: Michael Chang <[email protected]>
Reviewed-by: Avnish Chouhan <[email protected]>
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel