]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
udev-extraconf: Speed up mount.sh
authorRobert Tiemann <rtie@gmx.de>
Thu, 2 Oct 2025 09:59:24 +0000 (11:59 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 6 Oct 2025 22:15:57 +0000 (23:15 +0100)
On devices with many partitions, running blkid without parameters can
be rather slow because all block devices are inspected:

$ time /sbin/blkid
real    0m0.474s
user    0m0.026s
sys     0m0.172s

versus

$ time /sbin/blkid /dev/mmcblk0p10
real    0m0.027s
user    0m0.002s
sys     0m0.018s

Plugging in a device with 5 partitions means that mount.sh is going to
be executed 5 times, and so will be blkid. In the real-world case
outlined above, this adds up to an overhead of about 2.3 seconds for
blkid alone.

This commit changes mount.sh so that the block device of interest is
passed directly to blkid such that blkid inspects only that device,
leading to significant speedup.

Signed-off-by: Robert Tiemann <rtie@gmx.de>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/udev/udev-extraconf/mount.sh

index 0cbae48729bcbe6673b3e3bc93ca76b6aec4789a..fe78f3aba5442d5ffc2eb7fa758129f217f08a3b 100644 (file)
@@ -178,7 +178,7 @@ rm_dir() {
 
 get_label_name() {
        # Get the LABEL or PARTLABEL
-       LABEL=`/sbin/blkid | grep "$1:" | grep -o 'LABEL=".*"' | cut -d '"' -f2`
+       LABEL=`/sbin/blkid "$1" | grep -o 'LABEL=".*"' | cut -d '"' -f2`
        # If the $DEVNAME has a LABEL or a PARTLABEL
        if [ -n "$LABEL" ]; then
                # Set the mount location dir name to LABEL appended