public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rob Landley <rob@landley.net>
To: linux-kernel@vger.kernel.org
Subject: Re: [RFC] rootmpfs
Date: Wed, 03 Apr 2013 07:32:21 -0500	[thread overview]
Message-ID: <1364992341.18069.19@driftwood> (raw)
In-Reply-To: <1364992208.18069.18@driftwood> (from rob@landley.net on Wed Apr  3 07:30:08 2013)

[-- Attachment #1: Type: text/plain, Size: 205 bytes --]

On 04/03/2013 07:30:08 AM, Rob Landley wrote:
> Attached is my quick and dirty hack to make rootfs be tmpfs when  
> CONFIG_TMPFS is
> enabled.

For a somewhat quantum definition of "attached".

Rob

[-- Attachment #2: rootmpfs2.patch --]
[-- Type: text/x-patch, Size: 1140 bytes --]

diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index c24f1e1..f875bf2 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -244,10 +244,17 @@ struct dentry *ramfs_mount(struct file_system_type *fs_type,
 	return mount_nodev(fs_type, flags, data, ramfs_fill_super);
 }
 
-static struct dentry *rootfs_mount(struct file_system_type *fs_type,
+int shmem_init(void);
+int shmem_fill_super(struct super_block *sb, void *data, int silent);
+static __init struct dentry *rootfs_mount(struct file_system_type *fs_type,
 	int flags, const char *dev_name, void *data)
 {
+#ifdef CONFIG_TMPFS
+	if (shmem_init()) return NULL;
+	return mount_nodev(fs_type, flags, data, shmem_fill_super);
+#else
 	return mount_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super);
+#endif
 }
 
 static void ramfs_kill_sb(struct super_block *sb)
diff --git a/mm/shmem.c b/mm/shmem.c
index 1c44af7..d2cb93e 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2785,6 +2785,8 @@ int __init shmem_init(void)
 {
 	int error;
 
+	if (shmem_inode_cachep) return 0;
+
 	error = bdi_init(&shmem_backing_dev_info);
 	if (error)
 		goto out4;

  reply	other threads:[~2013-04-03 12:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-03 12:30 [RFC] rootmpfs Rob Landley
2013-04-03 12:32 ` Rob Landley [this message]
2013-04-05 19:53 ` Byron Stanoszek
2013-04-09 14:52   ` Rob Landley
2013-04-09 17:28     ` Randy Dunlap
2013-04-10 17:23       ` Rob Landley
2013-04-10 13:43 ` Robin Holt
2013-04-11 17:25 ` Lauri Kasanen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364992341.18069.19@driftwood \
    --to=rob@landley.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox