Commit a35100e0 authored by Andrew Morton's avatar Andrew Morton Committed by Dave Jones

[PATCH] Early writeback initialisation

Patch from Anders Gustafsson <andersg@0x63.nu>

We're getting a division-by-zero in the writeback code during early rootfs
population, because writeback has not yet been initialised.

Fix that by performing an explicit initialisation rather than relying on
initcall ordering.
parent 4403ea4b
...@@ -79,6 +79,7 @@ extern int dirty_writeback_centisecs; ...@@ -79,6 +79,7 @@ extern int dirty_writeback_centisecs;
extern int dirty_expire_centisecs; extern int dirty_expire_centisecs;
void page_writeback_init(void);
void balance_dirty_pages(struct address_space *mapping); void balance_dirty_pages(struct address_space *mapping);
void balance_dirty_pages_ratelimited(struct address_space *mapping); void balance_dirty_pages_ratelimited(struct address_space *mapping);
int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0); int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/profile.h> #include <linux/profile.h>
#include <linux/rcupdate.h> #include <linux/rcupdate.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/writeback.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/bugs.h> #include <asm/bugs.h>
...@@ -439,6 +440,8 @@ asmlinkage void __init start_kernel(void) ...@@ -439,6 +440,8 @@ asmlinkage void __init start_kernel(void)
vfs_caches_init(num_physpages); vfs_caches_init(num_physpages);
radix_tree_init(); radix_tree_init();
signals_init(); signals_init();
/* rootfs populating might need page-writeback */
page_writeback_init();
populate_rootfs(); populate_rootfs();
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
proc_root_init(); proc_root_init();
......
...@@ -369,7 +369,7 @@ static struct notifier_block ratelimit_nb = { ...@@ -369,7 +369,7 @@ static struct notifier_block ratelimit_nb = {
* dirty memory thresholds: allowing too much dirty highmem pins an excessive * dirty memory thresholds: allowing too much dirty highmem pins an excessive
* number of buffer_heads. * number of buffer_heads.
*/ */
static int __init page_writeback_init(void) void __init page_writeback_init(void)
{ {
long buffer_pages = nr_free_buffer_pages(); long buffer_pages = nr_free_buffer_pages();
long correction; long correction;
...@@ -392,9 +392,7 @@ static int __init page_writeback_init(void) ...@@ -392,9 +392,7 @@ static int __init page_writeback_init(void)
add_timer(&wb_timer); add_timer(&wb_timer);
set_ratelimit(); set_ratelimit();
register_cpu_notifier(&ratelimit_nb); register_cpu_notifier(&ratelimit_nb);
return 0;
} }
module_init(page_writeback_init);
int do_writepages(struct address_space *mapping, struct writeback_control *wbc) int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment