aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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 /drivers
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/rd.c20
-rw-r--r--drivers/char/mem.c5
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)
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);