diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2007-10-17 10:25:46 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 19:42:45 +0400 |
commit | e0bf68ddec4f4f90e5871404be4f1854c17f3120 (patch) | |
tree | 36203a3558cbe26d698bed18be69b3822fb5eef2 /drivers | |
parent | dc62a30e274d003a4d08fb888f1520add4b21373 (diff) | |
download | linux-e0bf68ddec4f4f90e5871404be4f1854c17f3120.tar.xz |
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 'drivers')
-rw-r--r-- | drivers/block/rd.c | 20 | ||||
-rw-r--r-- | drivers/char/mem.c | 5 |
2 files changed, 24 insertions, 1 deletions
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) blk_cleanup_queue(rd_queue[i]); } unregister_blkdev(RAMDISK_MAJOR, "ramdisk"); + + bdi_destroy(&rd_file_backing_dev_info); + bdi_destroy(&rd_backing_dev_info); } /* @@ -419,7 +422,19 @@ static void __exit rd_cleanup(void) static int __init rd_init(void) { int i; - int err = -ENOMEM; + int err; + + err = bdi_init(&rd_backing_dev_info); + if (err) + goto out2; + + err = bdi_init(&rd_file_backing_dev_info); + if (err) { + bdi_destroy(&rd_backing_dev_info); + goto out2; + } + + err = -ENOMEM; if (rd_blocksize > PAGE_SIZE || rd_blocksize < 512 || (rd_blocksize & (rd_blocksize-1))) { @@ -473,6 +488,9 @@ out: put_disk(rd_disks[i]); blk_cleanup_queue(rd_queue[i]); } + bdi_destroy(&rd_backing_dev_info); + bdi_destroy(&rd_file_backing_dev_info); +out2: return err; } 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; static int __init chr_dev_init(void) { int i; + int err; + + err = bdi_init(&zero_bdi); + if (err) + return err; if (register_chrdev(MEM_MAJOR,"mem",&memory_fops)) printk("unable to get major %d for memory devs\n", MEM_MAJOR); |