summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-09-11 14:26:12 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-11 15:59:37 -0700
commit16203a7a9422315bc929461503e3a046459ea5ff (patch)
treef32de38261ac95e4ac3467595a3f7be445b02797 /mm
parent57f150a58c40cda598c31af8bceb8598f43c3e5f (diff)
downloadlinux-16203a7a9422315bc929461503e3a046459ea5ff.tar.bz2
initmpfs: make rootfs use tmpfs when CONFIG_TMPFS enabled
Conditionally call the appropriate fs_init function and fill_super functions. Add a use once guard to shmem_init() to simply succeed on a second call. (Note that IS_ENABLED() is a compile time constant so dead code elimination removes unused function calls when CONFIG_TMPFS is disabled.) Signed-off-by: Rob Landley <rob@landley.net> Cc: Jeff Layton <jlayton@redhat.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Stephen Warren <swarren@nvidia.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/shmem.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index a1b8bf4391c2..8297623fcaed 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2819,6 +2819,10 @@ int __init shmem_init(void)
{
int error;
+ /* If rootfs called this, don't re-init */
+ if (shmem_inode_cachep)
+ return 0;
+
error = bdi_init(&shmem_backing_dev_info);
if (error)
goto out4;