diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2007-10-17 02:25:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 11:42:45 -0400 |
commit | e0bf68ddec4f4f90e5871404be4f1854c17f3120 (patch) | |
tree | 36203a3558cbe26d698bed18be69b3822fb5eef2 /mm | |
parent | dc62a30e274d003a4d08fb888f1520add4b21373 (diff) |
mm: bdi init hooks
provide BDI constructor/destructor hooks
[akpm@linux-foundation.org: compile fix]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/readahead.c | 6 | ||||
-rw-r--r-- | mm/shmem.c | 6 | ||||
-rw-r--r-- | mm/swap.c | 5 |
3 files changed, 17 insertions, 0 deletions
diff --git a/mm/readahead.c b/mm/readahead.c index 229788884010..c9c50ca1ec38 100644 --- a/mm/readahead.c +++ b/mm/readahead.c | |||
@@ -233,6 +233,12 @@ unsigned long max_sane_readahead(unsigned long nr) | |||
233 | + node_page_state(numa_node_id(), NR_FREE_PAGES)) / 2); | 233 | + node_page_state(numa_node_id(), NR_FREE_PAGES)) / 2); |
234 | } | 234 | } |
235 | 235 | ||
236 | static int __init readahead_init(void) | ||
237 | { | ||
238 | return bdi_init(&default_backing_dev_info); | ||
239 | } | ||
240 | subsys_initcall(readahead_init); | ||
241 | |||
236 | /* | 242 | /* |
237 | * Submit IO for the read-ahead request in file_ra_state. | 243 | * Submit IO for the read-ahead request in file_ra_state. |
238 | */ | 244 | */ |
diff --git a/mm/shmem.c b/mm/shmem.c index 8a82342a8595..2f039f32031f 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -2464,6 +2464,10 @@ static int __init init_tmpfs(void) | |||
2464 | { | 2464 | { |
2465 | int error; | 2465 | int error; |
2466 | 2466 | ||
2467 | error = bdi_init(&shmem_backing_dev_info); | ||
2468 | if (error) | ||
2469 | goto out4; | ||
2470 | |||
2467 | error = init_inodecache(); | 2471 | error = init_inodecache(); |
2468 | if (error) | 2472 | if (error) |
2469 | goto out3; | 2473 | goto out3; |
@@ -2488,6 +2492,8 @@ out1: | |||
2488 | out2: | 2492 | out2: |
2489 | destroy_inodecache(); | 2493 | destroy_inodecache(); |
2490 | out3: | 2494 | out3: |
2495 | bdi_destroy(&shmem_backing_dev_info); | ||
2496 | out4: | ||
2491 | shm_mnt = ERR_PTR(error); | 2497 | shm_mnt = ERR_PTR(error); |
2492 | return error; | 2498 | return error; |
2493 | } | 2499 | } |
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/percpu.h> | 28 | #include <linux/percpu.h> |
29 | #include <linux/cpu.h> | 29 | #include <linux/cpu.h> |
30 | #include <linux/notifier.h> | 30 | #include <linux/notifier.h> |
31 | #include <linux/backing-dev.h> | ||
31 | 32 | ||
32 | /* How many pages do we try to swap or page in/out together? */ | 33 | /* How many pages do we try to swap or page in/out together? */ |
33 | int page_cluster; | 34 | int page_cluster; |
@@ -547,6 +548,10 @@ void __init swap_setup(void) | |||
547 | { | 548 | { |
548 | unsigned long megs = num_physpages >> (20 - PAGE_SHIFT); | 549 | unsigned long megs = num_physpages >> (20 - PAGE_SHIFT); |
549 | 550 | ||
551 | #ifdef CONFIG_SWAP | ||
552 | bdi_init(swapper_space.backing_dev_info); | ||
553 | #endif | ||
554 | |||
550 | /* Use a smaller cluster for small-memory machines */ | 555 | /* Use a smaller cluster for small-memory machines */ |
551 | if (megs < 16) | 556 | if (megs < 16) |
552 | page_cluster = 2; | 557 | page_cluster = 2; |