floppy: Run floppy initialization asynchronous
Subsystems (2)
PATCH 1/1 floppy: Run floppy initialization asynchronous
From: Andi Kleen <[email protected]>
floppy_init is quite slow, 3s on my test system to determine that there is no floppy. Run it asynchronous to the other init calls to improve boot time.
--- drivers/block/floppy.c | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-)
drivers/block/floppy.c +20 -1
@@ -191,6 +191,7 @@ static int print_unex = 1;#include <linux/mutex.h> #include <linux/io.h> #include <linux/uaccess.h> +#include <linux/async.h> /* * PS/2 floppies have much slower step rates than regular floppies.
@@ -4122,7 +4123,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)return get_disk (disks[drive]); } -static int __init floppy_init (void ) +static int __init do_floppy_init (void ) {int i, unit, drive;int err, dr;
@@ -4337,6 +4338,24 @@ out_put_disk:return err; } +#ifndef MODULE +static __init void floppy_async_init (void *data,async_cookie_t cookie) +{ +do_floppy_init (); +} +#endif + +static int __init floppy_init (void ) +{ +#ifdef MODULE +return do_floppy_init (void); +#else +/* Don't hold up the bootup by the floppy initialization */ +async_schedule (floppy_async_init,NULL ); +return 0 ; +#endif +} + static const struct io_region { int offset; int size;
Signature · 1 line
1.7.7.6
Quoted 37 lines · Andi Kleen
From: Andi Kleen <[email protected]>
floppy_initis quite slow, 3s on my test system to determine that there is no floppy. Run it asynchronous to the other init calls to improve boot time.Signed-off-by Andi Kleen <[email protected]>--- drivers/block/floppy.c | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-)drivers/block/floppy.c +3
-1@@ -191,6 +191,7 @@ static int print_unex = 1;#include <linux/mutex.h> #include <linux/io.h> #include <linux/uaccess.h> +#include <linux/async.h> /* * PS/2 floppies have much slower step rates than regular floppies. @@ -4122,7 +4123,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)return get_disk (disks[drive]); } -static int __init floppy_init (void ) +static int __init do_floppy_init (void ) {int i, unit, drive;int err, dr;@@ -4337,6 +4338,24 @@ out_put_disk:return err; } +#ifndef MODULE
drivers/block/floppy.c out_put_disk: · line 4351
Quoted 10 lines
drivers/block/floppy.c +10
-0+static __init void floppy_async_init (void *data,async_cookie_t cookie) +{ +do_floppy_init (); +} +#endif + +static int __init floppy_init (void ) +{ +#ifdef MODULE +return do_floppy_init (void);
This isn't really a valid C.
I have fixed that and applied.
Signature · 2 lines
Jiri Kosina SUSE Labs
Quoted 52 lines · Jiri Kosina
Quoted 37 lines · Andi Kleen
From: Andi Kleen <[email protected]>
floppy_initis quite slow, 3s on my test system to determine that there is no floppy. Run it asynchronous to the other init calls to improve boot time.Signed-off-by Andi Kleen <[email protected]>--- drivers/block/floppy.c | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-)drivers/block/floppy.c +3
-1@@ -191,6 +191,7 @@ static int print_unex = 1;#include <linux/mutex.h> #include <linux/io.h> #include <linux/uaccess.h> +#include <linux/async.h> /* * PS/2 floppies have much slower step rates than regular floppies. @@ -4122,7 +4123,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)return get_disk (disks[drive]); } -static int __init floppy_init (void ) +static int __init do_floppy_init (void ) {int i, unit, drive;int err, dr;@@ -4337,6 +4338,24 @@ out_put_disk:return err; } +#ifndef MODULE drivers/block/floppy.c out_put_disk: · line 4351
Quoted 10 lines
drivers/block/floppy.c +10
-0+static __init void floppy_async_init (void *data,async_cookie_t cookie) +{ +do_floppy_init (); +} +#endif + +static int __init floppy_init (void ) +{ +#ifdef MODULE +return do_floppy_init (void);This isn't really a valid C.
Quoted 1 line
I have fixed that and applied.
Thanks.
It would be also good to figure out how to move floppy_init earlier in the init sequence. I think then you could hide more of the 3s latency than just 1s.
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only.