* [PATCH] make search faster by first trying without module autoloading
@ 2009-08-14 15:58 Vladimir 'phcoder' Serbinenko
2009-08-15 7:29 ` Yves Blusseau
2009-08-17 13:32 ` Robert Millan
0 siblings, 2 replies; 5+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-08-14 15:58 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 647 bytes --]
Hello. When search encounters an unknown filesystem or filesystem
without partition it triggers fs module autoload which takes
noticeable time. To improve the situation I propose (after discussing
with Robert Millan) to first search without autoloading modules if we
need to find only one device (with --set ) and retry with autoloading
if without autoloading the search failed. Additionally I modify
grub-mkconfig to load correct module manually before issuing search to
decrease booting time if filesystem is different that our boot one.
--
Regards
Vladimir 'phcoder' Serbinenko
Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
[-- Attachment #2: newsearch.diff --]
[-- Type: text/plain, Size: 2210 bytes --]
diff --git a/ChangeLog b/ChangeLog
index 8b76b58..31f33f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2009-08-14 Vladimir Serbinenko <phcoder@gmail.com>
+ * commands/search.c (search_fs): Try searching without autoload first.
+ * util/grub-mkconfig_lib.in (prepare_grub_to_access_device): Load
+ filesystem module explicitly for faster booting.
+
+2009-08-14 Vladimir Serbinenko <phcoder@gmail.com>
+
* loader/i386/multiboot.c (grub_multiboot_unload): Don't free mbi and
mbi->cmdline but free playground.
diff --git a/commands/search.c b/commands/search.c
index d10b51a..0cfd0eb 100644
--- a/commands/search.c
+++ b/commands/search.c
@@ -51,6 +51,7 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
{
int count = 0;
char *buf = NULL;
+ grub_fs_autoload_hook_t saved_autoload;
auto int iterate_device (const char *name);
int iterate_device (const char *name)
@@ -131,7 +132,22 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
return (found && var);
}
- grub_device_iterate (iterate_device);
+ /* First try without autoloading if we're setting variable. */
+ if (var)
+ {
+ saved_autoload = grub_fs_autoload_hook;
+ grub_fs_autoload_hook = 0;
+ grub_device_iterate (iterate_device);
+
+ /* Restore autoload hook. */
+ grub_fs_autoload_hook = saved_autoload;
+
+ /* Retry with autoload if nothing found. */
+ if (grub_errno == GRUB_ERR_NONE && count == 0)
+ grub_device_iterate (iterate_device);
+ }
+ else
+ grub_device_iterate (iterate_device);
grub_free (buf);
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index 3585a68..2385b08 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -140,6 +140,11 @@ prepare_grub_to_access_device ()
echo "insmod ${module}"
done
+ fs="`${grub_probe} --device ${device} --target=fs`"
+ for module in ${fs} ; do
+ echo "insmod ${module}"
+ done
+
# If there's a filesystem UUID that GRUB is capable of identifying, use it;
# otherwise set root as per value in device.map.
echo "set root=`${grub_probe} --device ${device} --target=drive`"
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] make search faster by first trying without module autoloading
2009-08-14 15:58 [PATCH] make search faster by first trying without module autoloading Vladimir 'phcoder' Serbinenko
@ 2009-08-15 7:29 ` Yves Blusseau
2009-08-17 13:32 ` Robert Millan
1 sibling, 0 replies; 5+ messages in thread
From: Yves Blusseau @ 2009-08-15 7:29 UTC (permalink / raw)
To: The development of GRUB 2
Le 14 août 09 à 17:58, Vladimir 'phcoder' Serbinenko a écrit :
> Hello. When search encounters an unknown filesystem or filesystem
> without partition it triggers fs module autoload which takes
> noticeable time. To improve the situation I propose (after discussing
> with Robert Millan) to first search without autoloading modules if we
> need to find only one device (with --set ) and retry with autoloading
> if without autoloading the search failed. Additionally I modify
> grub-mkconfig to load correct module manually before issuing search to
> decrease booting time if filesystem is different that our boot one.
Very good idea vladimir, but can you rename the var variable with
something more "speaking" ?
Regards,
Yves
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] make search faster by first trying without module autoloading
2009-08-14 15:58 [PATCH] make search faster by first trying without module autoloading Vladimir 'phcoder' Serbinenko
2009-08-15 7:29 ` Yves Blusseau
@ 2009-08-17 13:32 ` Robert Millan
2009-08-17 13:46 ` Vladimir 'phcoder' Serbinenko
1 sibling, 1 reply; 5+ messages in thread
From: Robert Millan @ 2009-08-17 13:32 UTC (permalink / raw)
To: The development of GRUB 2
On Fri, Aug 14, 2009 at 05:58:20PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> Hello. When search encounters an unknown filesystem or filesystem
> without partition it triggers fs module autoload which takes
> noticeable time. To improve the situation I propose (after discussing
> with Robert Millan) to first search without autoloading modules if we
> need to find only one device (with --set ) and retry with autoloading
> if without autoloading the search failed. Additionally I modify
> grub-mkconfig to load correct module manually before issuing search to
> decrease booting time if filesystem is different that our boot one.
Looks good to me. Also, I think Yves suggestion is a good idea.
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] make search faster by first trying without module autoloading
2009-08-17 13:32 ` Robert Millan
@ 2009-08-17 13:46 ` Vladimir 'phcoder' Serbinenko
2009-08-17 14:07 ` Robert Millan
0 siblings, 1 reply; 5+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-08-17 13:46 UTC (permalink / raw)
To: The development of GRUB 2
On Mon, Aug 17, 2009 at 3:32 PM, Robert Millan<rmh@aybabtu.com> wrote:
> On Fri, Aug 14, 2009 at 05:58:20PM +0200, Vladimir 'phcoder' Serbinenko wrote:
>> Hello. When search encounters an unknown filesystem or filesystem
>> without partition it triggers fs module autoload which takes
>> noticeable time. To improve the situation I propose (after discussing
>> with Robert Millan) to first search without autoloading modules if we
>> need to find only one device (with --set ) and retry with autoloading
>> if without autoloading the search failed. Additionally I modify
>> grub-mkconfig to load correct module manually before issuing search to
>> decrease booting time if filesystem is different that our boot one.
>
> Looks good to me. Also, I think Yves suggestion is a good idea.
>
In this case 'var' stands for a 'variable' which is sensible in this
case since it's environment variable name.
> --
> Robert Millan
>
> The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
> how) you may access your data; but nobody's threatening your freedom: we
> still allow you to remove your data and not access it at all."
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'phcoder' Serbinenko
Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] make search faster by first trying without module autoloading
2009-08-17 13:46 ` Vladimir 'phcoder' Serbinenko
@ 2009-08-17 14:07 ` Robert Millan
0 siblings, 0 replies; 5+ messages in thread
From: Robert Millan @ 2009-08-17 14:07 UTC (permalink / raw)
To: The development of GRUB 2
On Mon, Aug 17, 2009 at 03:46:40PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> On Mon, Aug 17, 2009 at 3:32 PM, Robert Millan<rmh@aybabtu.com> wrote:
> > On Fri, Aug 14, 2009 at 05:58:20PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> >> Hello. When search encounters an unknown filesystem or filesystem
> >> without partition it triggers fs module autoload which takes
> >> noticeable time. To improve the situation I propose (after discussing
> >> with Robert Millan) to first search without autoloading modules if we
> >> need to find only one device (with --set ) and retry with autoloading
> >> if without autoloading the search failed. Additionally I modify
> >> grub-mkconfig to load correct module manually before issuing search to
> >> decrease booting time if filesystem is different that our boot one.
> >
> > Looks good to me. Also, I think Yves suggestion is a good idea.
> >
> In this case 'var' stands for a 'variable' which is sensible in this
> case since it's environment variable name.
Ah, ok.
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-08-17 14:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-14 15:58 [PATCH] make search faster by first trying without module autoloading Vladimir 'phcoder' Serbinenko
2009-08-15 7:29 ` Yves Blusseau
2009-08-17 13:32 ` Robert Millan
2009-08-17 13:46 ` Vladimir 'phcoder' Serbinenko
2009-08-17 14:07 ` Robert Millan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.