mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
initmpfs: move bdi setup from init_rootfs to init_ramfs
Even though ramfs hasn't got a backing device, commit e0bf68ddec ("mm:
bdi init hooks") added one anyway, and put the initialization in
init_rootfs() since that's the first user, leaving it out of init_ramfs()
to avoid duplication.
But initmpfs uses init_tmpfs() instead, so move the init into the
filesystem's init function, add a "once" guard to prevent duplicate
initialization, and call the filesystem init from rootfs init.
This goes part of the way to allowing ramfs to be built as a module.
[[email protected]; using bit 1 was odd]
Signed-off-by: Rob Landley <[email protected]>
Cc: Jeff Layton <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Stephen Warren <[email protected]>
Cc: Rusty Russell <[email protected]>
Cc: Jim Cromie <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Alexander Viro <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
137fdcc18a
commit
4bbee76bc9
1 changed files with 19 additions and 6 deletions
|
|
@ -249,7 +249,7 @@ static struct dentry *rootfs_mount(struct file_system_type *fs_type,
|
|||
{
|
||||
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);
|
||||
|
|
@ -275,21 +275,34 @@ static struct file_system_type rootfs_fs_type = {
|
|||
|
||||
static int __init init_ramfs_fs(void)
|
||||
{
|
||||
return register_filesystem(&ramfs_fs_type);
|
||||
}
|
||||
module_init(init_ramfs_fs)
|
||||
|
||||
int __init init_rootfs(void)
|
||||
{
|
||||
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(&rootfs_fs_type);
|
||||
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 = register_filesystem(&rootfs_fs_type);
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = init_ramfs_fs();
|
||||
if (err)
|
||||
unregister_filesystem(&rootfs_fs_type);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue