Skip to contentSkip to conversation

+ initmpfs-move-bdi-setup-from-init_rootfs-to-init_ramfs.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Jul 19, 2013

lore
Share & tools
lore
#0 lore raw

Subject: + initmpfs-move-bdi-setup-from-init_rootfs-to-init_ramfs.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Fri, 19 Jul 2013 12:57:48 -0700

The patch titled
Subject: initmpfs: move bdi setup from init_rootfs to init_ramfs
has been added to the -mm tree. Its filename is
initmpfs-move-bdi-setup-from-init_rootfs-to-init_ramfs.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/initmpfs-move-bdi-setup-from-init_rootfs-to-init_ramfs.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/initmpfs-move-bdi-setup-from-init_rootfs-to-init_ramfs.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Rob Landley <[email protected]>
Subject: initmpfs: move bdi setup from init_rootfs to init_ramfs

Even though ramfs hasn't got a backing device, commit e0bf68ddec4f ("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.

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]>

---

 fs/ramfs/inode.c |   23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)
fs/ramfs/inode.c renamed from fs/ramfs/inode.c~initmpfs-move-bdi-setup-from-init_rootfs-to-init_ramfs +18 -5
diff -puN fs/ramfs/inode.c~initmpfs-move-bdi-setup-from-init_rootfs-to-init_ramfs fs/ramfs/inode.c
@@ -275,21 +275,34 @@ static struct file_system_type rootfs_fs
 
 static int __init init_ramfs_fs(void)
 {
-	return register_filesystem(&ramfs_fs_type);
+	static unsigned long once;
+	int err;
+
+	if (test_and_set_bit(1, &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;
 }

_

Patches currently in -mm which might be from [email protected] are

x86-make-mem=-option-to-work-for-efi-platform.patch initmpfs-replace-ms_nouser-in-initramfs.patch initmpfs-move-bdi-setup-from-init_rootfs-to-init_ramfs.patch initmpfs-move-bdi-setup-from-init_rootfs-to-init_ramfs-fix.patch initmpfs-move-rootfs-code-from-fs-ramfs-to-init.patch initmpfs-make-rootfs-use-tmpfs-when-config_tmpfs-enabled.patch initmpfs-use-initramfs-if-rootfstype=-or-root=-specified.patch