{
static unsigned long once;
- if (test_and_set_bit(1, &once))
+ if (test_and_set_bit(0, &once))
return ERR_PTR(-ENODEV);
return mount_nodev(fs_type, flags, data, ramfs_fill_super);
static int __init init_ramfs_fs(void)
{
- return register_filesystem(&ramfs_fs_type);
+ static unsigned long once;
+ int err;
+
+ if (test_and_set_bit(0, &once))
+ return 0;
+
+ err = bdi_init(&ramfs_backing_dev_info);
+ if (err)
+ return err;
+
+ err = register_filesystem(&ramfs_fs_type);
+ if (err)
+ bdi_destroy(&ramfs_backing_dev_info);
+
+ return err;
}
module_init(init_ramfs_fs)
int __init init_rootfs(void)
{
- int err;
+ int err = register_filesystem(&rootfs_fs_type);
- err = bdi_init(&ramfs_backing_dev_info);
if (err)
return err;
- err = register_filesystem(&rootfs_fs_type);
+ err = init_ramfs_fs();
if (err)
- bdi_destroy(&ramfs_backing_dev_info);
+ unregister_filesystem(&rootfs_fs_type);
return err;
}