Don't stat devices unless we have to.

* grub-core/kern/emu/getroot.c (grub_find_device): Recognize
	dir == /dev/mapper.
	(grub_guess_root_device): Use already known os_dev if possible.
	* grub-core/kern/emu/hostdisk.c
	(convert_system_partition_to_system_disk): Scan only in /dev/mapper
	if device is known to be a dm one.

	Also-By: Colin Watson <cjwatson@ubuntu.com>
This commit is contained in:
Vladimir Serbinenko 2011-05-21 07:03:55 +02:00 committed by Vladimir 'phcoder' Serbinenko
parent f35fa3a664
commit f767c929f2
3 changed files with 34 additions and 14 deletions

View file

@ -1408,7 +1408,8 @@ convert_system_partition_to_system_disk (const char *os_dev, struct stat *st)
if (tree)
dm_tree_free (tree);
free (path);
char *ret = grub_find_device (NULL, (major << 8) | minor);
char *ret = grub_find_device ("/dev/mapper",
(major << 8) | minor);
return ret;
}