aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2007-10-17 02:25:46 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:42:45 -0400
commite0bf68ddec4f4f90e5871404be4f1854c17f3120 (patch)
tree36203a3558cbe26d698bed18be69b3822fb5eef2
parentdc62a30e274d003a4d08fb888f1520add4b21373 (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>
-rw-r--r--block/ll_rw_blk.c13
-rw-r--r--drivers/block/rd.c20
-rw-r--r--drivers/char/mem.c5
-rw-r--r--fs/char_dev.c1
-rw-r--r--fs/configfs/configfs_internal.h2
-rw-r--r--fs/configfs/inode.c8
-rw-r--r--fs/configfs/mount.c9
-rw-r--r--fs/fuse/inode.c9
-rw-r--r--fs/hugetlbfs/inode.c9
-rw-r--r--fs/nfs/client.c6
-rw-r--r--fs/ocfs2/dlm/dlmfs.c9
-rw-r--r--fs/ramfs/inode.c12
-rw-r--r--fs/sysfs/inode.c5
-rw-r--r--fs/sysfs/mount.c4
-rw-r--r--fs/sysfs/sysfs.h1
-rw-r--r--include/linux/backing-dev.h8
-rw-r--r--mm/readahead.c6
-rw-r--r--mm/shmem.c6
-rw-r--r--mm/swap.c5
19 files changed, 131 insertions, 7 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 9eabac95fbe0..524404bd08c1 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -1786,6 +1786,7 @@ static void blk_release_queue(struct kobject *kobj)
1786 1786
1787 blk_trace_shutdown(q); 1787 blk_trace_shutdown(q);
1788 1788
1789 bdi_destroy(&q->backing_dev_info);
1789 kmem_cache_free(requestq_cachep, q); 1790 kmem_cache_free(requestq_cachep, q);
1790} 1791}
1791 1792
@@ -1839,21 +1840,27 @@ static struct kobj_type queue_ktype;
1839struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) 1840struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
1840{ 1841{
1841 struct request_queue *q; 1842 struct request_queue *q;
1843 int err;
1842 1844
1843 q = kmem_cache_alloc_node(requestq_cachep, 1845 q = kmem_cache_alloc_node(requestq_cachep,
1844 gfp_mask | __GFP_ZERO, node_id); 1846 gfp_mask | __GFP_ZERO, node_id);
1845 if (!q) 1847 if (!q)
1846 return NULL; 1848 return NULL;
1847 1849
1850 q->backing_dev_info.unplug_io_fn = blk_backing_dev_unplug;
1851 q->backing_dev_info.unplug_io_data = q;
1852 err = bdi_init(&q->backing_dev_info);
1853 if (err) {
1854 kmem_cache_free(requestq_cachep, q);
1855 return NULL;
1856 }
1857
1848 init_timer(&q->unplug_timer); 1858 init_timer(&q->unplug_timer);
1849 1859
1850 kobject_set_name(&q->kobj, "%s", "queue"); 1860 kobject_set_name(&q->kobj, "%s", "queue");
1851 q->kobj.ktype = &queue_ktype; 1861 q->kobj.ktype = &queue_ktype;
1852 kobject_init(&q->kobj); 1862 kobject_init(&q->kobj);
1853 1863
1854 q->backing_dev_info.unplug_io_fn = blk_backing_dev_unplug;
1855 q->backing_dev_info.unplug_io_data = q;
1856
1857 mutex_init(&q->sysfs_lock); 1864 mutex_init(&q->sysfs_lock);
1858 1865
1859 return q; 1866 return q;
diff --git a/drivers/block/rd.c b/drivers/block/rd.c
index 701ea77f62e9..80e1585b741e 100644
--- a/drivers/block/rd.c
+++ b/drivers/block/rd.c
@@ -411,6 +411,9 @@ static void __exit rd_cleanup(void)
411 blk_cleanup_queue(rd_queue[i]); 411 blk_cleanup_queue(rd_queue[i]);
412 } 412 }
413 unregister_blkdev(RAMDISK_MAJOR, "ramdisk"); 413 unregister_blkdev(RAMDISK_MAJOR, "ramdisk");
414
415 bdi_destroy(&rd_file_backing_dev_info);
416 bdi_destroy(&rd_backing_dev_info);
414} 417}
415 418
416/* 419/*
@@ -419,7 +422,19 @@ static void __exit rd_cleanup(void)
419static int __init rd_init(void) 422static int __init rd_init(void)
420{ 423{
421 int i; 424 int i;
422 int err = -ENOMEM; 425 int err;
426
427 err = bdi_init(&rd_backing_dev_info);
428 if (err)
429 goto out2;
430
431 err = bdi_init(&rd_file_backing_dev_info);
432 if (err) {
433 bdi_destroy(&rd_backing_dev_info);
434 goto out2;
435 }
436
437 err = -ENOMEM;
423 438
424 if (rd_blocksize > PAGE_SIZE || rd_blocksize < 512 || 439 if (rd_blocksize > PAGE_SIZE || rd_blocksize < 512 ||
425 (rd_blocksize & (rd_blocksize-1))) { 440 (rd_blocksize & (rd_blocksize-1))) {
@@ -473,6 +488,9 @@ out:
473 put_disk(rd_disks[i]); 488 put_disk(rd_disks[i]);
474 blk_cleanup_queue(rd_queue[i]); 489 blk_cleanup_queue(rd_queue[i]);
475 } 490 }
491 bdi_destroy(&rd_backing_dev_info);
492 bdi_destroy(&rd_file_backing_dev_info);
493out2:
476 return err; 494 return err;
477} 495}
478 496
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 64551ab6be03..0e937f64a789 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -893,6 +893,11 @@ static struct class *mem_class;
893static int __init chr_dev_init(void) 893static int __init chr_dev_init(void)
894{ 894{
895 int i; 895 int i;
896 int err;
897
898 err = bdi_init(&zero_bdi);
899 if (err)
900 return err;
896 901
897 if (register_chrdev(MEM_MAJOR,"mem",&memory_fops)) 902 if (register_chrdev(MEM_MAJOR,"mem",&memory_fops))
898 printk("unable to get major %d for memory devs\n", MEM_MAJOR); 903 printk("unable to get major %d for memory devs\n", MEM_MAJOR);
diff --git a/fs/char_dev.c b/fs/char_dev.c
index bbbf07baa145..c3bfa76765c4 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -545,6 +545,7 @@ static struct kobject *base_probe(dev_t dev, int *part, void *data)
545void __init chrdev_init(void) 545void __init chrdev_init(void)
546{ 546{
547 cdev_map = kobj_map_init(base_probe, &chrdevs_lock); 547 cdev_map = kobj_map_init(base_probe, &chrdevs_lock);
548 bdi_init(&directly_mappable_cdev_bdi);
548} 549}
549 550
550 551
diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h
index 3b0185fdf9a4..cca98609aa7f 100644
--- a/fs/configfs/configfs_internal.h
+++ b/fs/configfs/configfs_internal.h
@@ -56,6 +56,8 @@ extern int configfs_is_root(struct config_item *item);
56 56
57extern struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent *); 57extern struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent *);
58extern int configfs_create(struct dentry *, int mode, int (*init)(struct inode *)); 58extern int configfs_create(struct dentry *, int mode, int (*init)(struct inode *));
59extern int configfs_inode_init(void);
60extern void configfs_inode_exit(void);
59 61
60extern int configfs_create_file(struct config_item *, const struct configfs_attribute *); 62extern int configfs_create_file(struct config_item *, const struct configfs_attribute *);
61extern int configfs_make_dirent(struct configfs_dirent *, 63extern int configfs_make_dirent(struct configfs_dirent *,
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c
index dbd257d956c4..4c1ebff778ee 100644
--- a/fs/configfs/inode.c
+++ b/fs/configfs/inode.c
@@ -256,4 +256,12 @@ void configfs_hash_and_remove(struct dentry * dir, const char * name)
256 mutex_unlock(&dir->d_inode->i_mutex); 256 mutex_unlock(&dir->d_inode->i_mutex);
257} 257}
258 258
259int __init configfs_inode_init(void)
260{
261 return bdi_init(&configfs_backing_dev_info);
262}
259 263
264void __exit configfs_inode_exit(void)
265{
266 bdi_destroy(&configfs_backing_dev_info);
267}
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 871b0cb61839..3bf0278ea843 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -154,8 +154,16 @@ static int __init configfs_init(void)
154 subsystem_unregister(&config_subsys); 154 subsystem_unregister(&config_subsys);
155 kmem_cache_destroy(configfs_dir_cachep); 155 kmem_cache_destroy(configfs_dir_cachep);
156 configfs_dir_cachep = NULL; 156 configfs_dir_cachep = NULL;
157 goto out;
157 } 158 }
158 159
160 err = configfs_inode_init();
161 if (err) {
162 unregister_filesystem(&configfs_fs_type);
163 subsystem_unregister(&config_subsys);
164 kmem_cache_destroy(configfs_dir_cachep);
165 configfs_dir_cachep = NULL;
166 }
159out: 167out:
160 return err; 168 return err;
161} 169}
@@ -166,6 +174,7 @@ static void __exit configfs_exit(void)
166 subsystem_unregister(&config_subsys); 174 subsystem_unregister(&config_subsys);
167 kmem_cache_destroy(configfs_dir_cachep); 175 kmem_cache_destroy(configfs_dir_cachep);
168 configfs_dir_cachep = NULL; 176 configfs_dir_cachep = NULL;
177 configfs_inode_exit();
169} 178}
170 179
171MODULE_AUTHOR("Oracle"); 180MODULE_AUTHOR("Oracle");
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 5448f625ab56..ca30b6ac03f0 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -401,6 +401,7 @@ static int fuse_show_options(struct seq_file *m, struct vfsmount *mnt)
401static struct fuse_conn *new_conn(void) 401static struct fuse_conn *new_conn(void)
402{ 402{
403 struct fuse_conn *fc; 403 struct fuse_conn *fc;
404 int err;
404 405
405 fc = kzalloc(sizeof(*fc), GFP_KERNEL); 406 fc = kzalloc(sizeof(*fc), GFP_KERNEL);
406 if (fc) { 407 if (fc) {
@@ -416,10 +417,17 @@ static struct fuse_conn *new_conn(void)
416 atomic_set(&fc->num_waiting, 0); 417 atomic_set(&fc->num_waiting, 0);
417 fc->bdi.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE; 418 fc->bdi.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
418 fc->bdi.unplug_io_fn = default_unplug_io_fn; 419 fc->bdi.unplug_io_fn = default_unplug_io_fn;
420 err = bdi_init(&fc->bdi);
421 if (err) {
422 kfree(fc);
423 fc = NULL;
424 goto out;
425 }
419 fc->reqctr = 0; 426 fc->reqctr = 0;
420 fc->blocked = 1; 427 fc->blocked = 1;
421 get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key)); 428 get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key));
422 } 429 }
430out:
423 return fc; 431 return fc;
424} 432}
425 433
@@ -429,6 +437,7 @@ void fuse_conn_put(struct fuse_conn *fc)
429 if (fc->destroy_req) 437 if (fc->destroy_req)
430 fuse_request_free(fc->destroy_req); 438 fuse_request_free(fc->destroy_req);
431 mutex_destroy(&fc->inst_mutex); 439 mutex_destroy(&fc->inst_mutex);
440 bdi_destroy(&fc->bdi);
432 kfree(fc); 441 kfree(fc);
433 } 442 }
434} 443}
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 04598e12c489..0d9a2055ddee 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -974,11 +974,15 @@ static int __init init_hugetlbfs_fs(void)
974 int error; 974 int error;
975 struct vfsmount *vfsmount; 975 struct vfsmount *vfsmount;
976 976
977 error = bdi_init(&hugetlbfs_backing_dev_info);
978 if (error)
979 return error;
980
977 hugetlbfs_inode_cachep = kmem_cache_create("hugetlbfs_inode_cache", 981 hugetlbfs_inode_cachep = kmem_cache_create("hugetlbfs_inode_cache",
978 sizeof(struct hugetlbfs_inode_info), 982 sizeof(struct hugetlbfs_inode_info),
979 0, 0, init_once); 983 0, 0, init_once);
980 if (hugetlbfs_inode_cachep == NULL) 984 if (hugetlbfs_inode_cachep == NULL)
981 return -ENOMEM; 985 goto out2;
982 986
983 error = register_filesystem(&hugetlbfs_fs_type); 987 error = register_filesystem(&hugetlbfs_fs_type);
984 if (error) 988 if (error)
@@ -996,6 +1000,8 @@ static int __init init_hugetlbfs_fs(void)
996 out: 1000 out:
997 if (error) 1001 if (error)
998 kmem_cache_destroy(hugetlbfs_inode_cachep); 1002 kmem_cache_destroy(hugetlbfs_inode_cachep);
1003 out2:
1004 bdi_destroy(&hugetlbfs_backing_dev_info);
999 return error; 1005 return error;
1000} 1006}
1001 1007
@@ -1003,6 +1009,7 @@ static void __exit exit_hugetlbfs_fs(void)
1003{ 1009{
1004 kmem_cache_destroy(hugetlbfs_inode_cachep); 1010 kmem_cache_destroy(hugetlbfs_inode_cachep);
1005 unregister_filesystem(&hugetlbfs_fs_type); 1011 unregister_filesystem(&hugetlbfs_fs_type);
1012 bdi_destroy(&hugetlbfs_backing_dev_info);
1006} 1013}
1007 1014
1008module_init(init_hugetlbfs_fs) 1015module_init(init_hugetlbfs_fs)
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index a532ee12740a..70587f383f10 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -627,6 +627,7 @@ static void nfs_server_set_fsinfo(struct nfs_server *server, struct nfs_fsinfo *
627 if (server->rsize > NFS_MAX_FILE_IO_SIZE) 627 if (server->rsize > NFS_MAX_FILE_IO_SIZE)
628 server->rsize = NFS_MAX_FILE_IO_SIZE; 628 server->rsize = NFS_MAX_FILE_IO_SIZE;
629 server->rpages = (server->rsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 629 server->rpages = (server->rsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
630
630 server->backing_dev_info.ra_pages = server->rpages * NFS_MAX_READAHEAD; 631 server->backing_dev_info.ra_pages = server->rpages * NFS_MAX_READAHEAD;
631 632
632 if (server->wsize > max_rpc_payload) 633 if (server->wsize > max_rpc_payload)
@@ -677,6 +678,10 @@ static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, str
677 goto out_error; 678 goto out_error;
678 679
679 nfs_server_set_fsinfo(server, &fsinfo); 680 nfs_server_set_fsinfo(server, &fsinfo);
681 error = bdi_init(&server->backing_dev_info);
682 if (error)
683 goto out_error;
684
680 685
681 /* Get some general file system info */ 686 /* Get some general file system info */
682 if (server->namelen == 0) { 687 if (server->namelen == 0) {
@@ -756,6 +761,7 @@ void nfs_free_server(struct nfs_server *server)
756 nfs_put_client(server->nfs_client); 761 nfs_put_client(server->nfs_client);
757 762
758 nfs_free_iostats(server->io_stats); 763 nfs_free_iostats(server->io_stats);
764 bdi_destroy(&server->backing_dev_info);
759 kfree(server); 765 kfree(server);
760 nfs_release_automount_timer(); 766 nfs_release_automount_timer();
761 dprintk("<-- nfs_free_server()\n"); 767 dprintk("<-- nfs_free_server()\n");
diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
index 7418dc83de1c..1150412758ac 100644
--- a/fs/ocfs2/dlm/dlmfs.c
+++ b/fs/ocfs2/dlm/dlmfs.c
@@ -588,13 +588,17 @@ static int __init init_dlmfs_fs(void)
588 588
589 dlmfs_print_version(); 589 dlmfs_print_version();
590 590
591 status = bdi_init(&dlmfs_backing_dev_info);
592 if (status)
593 return status;
594
591 dlmfs_inode_cache = kmem_cache_create("dlmfs_inode_cache", 595 dlmfs_inode_cache = kmem_cache_create("dlmfs_inode_cache",
592 sizeof(struct dlmfs_inode_private), 596 sizeof(struct dlmfs_inode_private),
593 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT| 597 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
594 SLAB_MEM_SPREAD), 598 SLAB_MEM_SPREAD),
595 dlmfs_init_once); 599 dlmfs_init_once);
596 if (!dlmfs_inode_cache) 600 if (!dlmfs_inode_cache)
597 return -ENOMEM; 601 goto bail;
598 cleanup_inode = 1; 602 cleanup_inode = 1;
599 603
600 user_dlm_worker = create_singlethread_workqueue("user_dlm"); 604 user_dlm_worker = create_singlethread_workqueue("user_dlm");
@@ -611,6 +615,7 @@ bail:
611 kmem_cache_destroy(dlmfs_inode_cache); 615 kmem_cache_destroy(dlmfs_inode_cache);
612 if (cleanup_worker) 616 if (cleanup_worker)
613 destroy_workqueue(user_dlm_worker); 617 destroy_workqueue(user_dlm_worker);
618 bdi_destroy(&dlmfs_backing_dev_info);
614 } else 619 } else
615 printk("OCFS2 User DLM kernel interface loaded\n"); 620 printk("OCFS2 User DLM kernel interface loaded\n");
616 return status; 621 return status;
@@ -624,6 +629,8 @@ static void __exit exit_dlmfs_fs(void)
624 destroy_workqueue(user_dlm_worker); 629 destroy_workqueue(user_dlm_worker);
625 630
626 kmem_cache_destroy(dlmfs_inode_cache); 631 kmem_cache_destroy(dlmfs_inode_cache);
632
633 bdi_destroy(&dlmfs_backing_dev_info);
627} 634}
628 635
629MODULE_AUTHOR("Oracle"); 636MODULE_AUTHOR("Oracle");
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index ef2b46d099ff..8428d5b2711d 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -223,7 +223,17 @@ module_exit(exit_ramfs_fs)
223 223
224int __init init_rootfs(void) 224int __init init_rootfs(void)
225{ 225{
226 return register_filesystem(&rootfs_fs_type); 226 int err;
227
228 err = bdi_init(&ramfs_backing_dev_info);
229 if (err)
230 return err;
231
232 err = register_filesystem(&rootfs_fs_type);
233 if (err)
234 bdi_destroy(&ramfs_backing_dev_info);
235
236 return err;
227} 237}
228 238
229MODULE_LICENSE("GPL"); 239MODULE_LICENSE("GPL");
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index c4ef945d39c8..d9262f74f94e 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -37,6 +37,11 @@ static const struct inode_operations sysfs_inode_operations ={
37 .setattr = sysfs_setattr, 37 .setattr = sysfs_setattr,
38}; 38};
39 39
40int __init sysfs_inode_init(void)
41{
42 return bdi_init(&sysfs_backing_dev_info);
43}
44
40int sysfs_setattr(struct dentry * dentry, struct iattr * iattr) 45int sysfs_setattr(struct dentry * dentry, struct iattr * iattr)
41{ 46{
42 struct inode * inode = dentry->d_inode; 47 struct inode * inode = dentry->d_inode;
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index c76c540be3c8..74168266cd59 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -92,6 +92,10 @@ int __init sysfs_init(void)
92 if (!sysfs_dir_cachep) 92 if (!sysfs_dir_cachep)
93 goto out; 93 goto out;
94 94
95 err = sysfs_inode_init();
96 if (err)
97 goto out_err;
98
95 err = register_filesystem(&sysfs_fs_type); 99 err = register_filesystem(&sysfs_fs_type);
96 if (!err) { 100 if (!err) {
97 sysfs_mount = kern_mount(&sysfs_fs_type); 101 sysfs_mount = kern_mount(&sysfs_fs_type);
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index f0326f281d1c..f8417988f6b0 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -146,6 +146,7 @@ static inline void sysfs_put(struct sysfs_dirent *sd)
146struct inode *sysfs_get_inode(struct sysfs_dirent *sd); 146struct inode *sysfs_get_inode(struct sysfs_dirent *sd);
147int sysfs_setattr(struct dentry *dentry, struct iattr *iattr); 147int sysfs_setattr(struct dentry *dentry, struct iattr *iattr);
148int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name); 148int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name);
149int sysfs_inode_init(void);
149 150
150/* 151/*
151 * file.c 152 * file.c
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 210933c336f5..8f56634f537a 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -34,6 +34,14 @@ struct backing_dev_info {
34 void *unplug_io_data; 34 void *unplug_io_data;
35}; 35};
36 36
37static inline int bdi_init(struct backing_dev_info *bdi)
38{
39 return 0;
40}
41
42static inline void bdi_destroy(struct backing_dev_info *bdi)
43{
44}
37 45
38/* 46/*
39 * Flags in backing_dev_info::capability 47 * Flags in backing_dev_info::capability
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
236static int __init readahead_init(void)
237{
238 return bdi_init(&default_backing_dev_info);
239}
240subsys_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:
2488out2: 2492out2:
2489 destroy_inodecache(); 2493 destroy_inodecache();
2490out3: 2494out3:
2495 bdi_destroy(&shmem_backing_dev_info);
2496out4:
2491 shm_mnt = ERR_PTR(error); 2497 shm_mnt = ERR_PTR(error);
2492 return error; 2498 return error;
2493} 2499}
diff --git a/mm/swap.c b/mm/swap.c
index d034b2128d2b..a65eff8a517a 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -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? */
33int page_cluster; 34int 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;