]> git.ozlabs.org Git - petitboot/commit
discover: Use ID_FS_TYPE property for filesystem type detection
authorJeremy Kerr <jk@ozlabs.org>
Thu, 13 Mar 2014 02:07:12 +0000 (10:07 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Fri, 14 Mar 2014 07:14:47 +0000 (15:14 +0800)
commit43f340b66d8323c6e797868d07fc98482052ba35
tree5a7b93384aa112a7e9a15b6ee55c0f3f0d29e8a6
parentbb3ddd63720501f451d3f2797f315c25efd3bd4a
discover: Use ID_FS_TYPE property for filesystem type detection

Currently, we don't hand any -t option to mount, as we expect the mount
binary to do autodetection of the filesystem type for us.

Turns out this isn't great with busybox mount, (which we're likely to be
using in petitboot builds), which implements "autodetection" by trying
the mount() syscall with every fs type in /proc/filesystems, until one
succeeds.

We expect a lot of the mount calls to fail, as we currently try to mount
everything (and abort discovery on devices that don't mount), including
non-filesystem partitions. On a test machine with 560 block devices, and
37 entries in /proc/partitions, this results in around 20,000 calls to
mount().

A better way would be to pass a -t option to mount. It turns out that
udev uses libblkid to probe the filesystem type, which is available in
the ID_FS_TYPE property. This change only attempts to mount filesystems
with this property, and passes an explicit fstype to the mount binary.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/device-handler.c
discover/udev.c