]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/jffs2/super.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[karo-tx-linux.git] / fs / jffs2 / super.c
index e7e97445411569d506ad5ac845e9cff3fc511971..bc586f204228633ed2d3bcf388991a0ec4b21ff8 100644 (file)
@@ -9,6 +9,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -45,7 +47,6 @@ static struct inode *jffs2_alloc_inode(struct super_block *sb)
 static void jffs2_i_callback(struct rcu_head *head)
 {
        struct inode *inode = container_of(head, struct inode, i_rcu);
-       INIT_LIST_HEAD(&inode->i_dentry);
        kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode));
 }
 
@@ -62,21 +63,6 @@ static void jffs2_i_init_once(void *foo)
        inode_init_once(&f->vfs_inode);
 }
 
-static void jffs2_write_super(struct super_block *sb)
-{
-       struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
-
-       lock_super(sb);
-       sb->s_dirt = 0;
-
-       if (!(sb->s_flags & MS_RDONLY)) {
-               D1(printk(KERN_DEBUG "jffs2_write_super()\n"));
-               jffs2_flush_wbuf_gc(c, 0);
-       }
-
-       unlock_super(sb);
-}
-
 static const char *jffs2_compr_name(unsigned int compr)
 {
        switch (compr) {
@@ -97,9 +83,9 @@ static const char *jffs2_compr_name(unsigned int compr)
        }
 }
 
-static int jffs2_show_options(struct seq_file *s, struct vfsmount *mnt)
+static int jffs2_show_options(struct seq_file *s, struct dentry *root)
 {
-       struct jffs2_sb_info *c = JFFS2_SB_INFO(mnt->mnt_sb);
+       struct jffs2_sb_info *c = JFFS2_SB_INFO(root->d_sb);
        struct jffs2_mount_opts *opts = &c->mount_opts;
 
        if (opts->override_compr)
@@ -112,8 +98,6 @@ static int jffs2_sync_fs(struct super_block *sb, int wait)
 {
        struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
 
-       jffs2_write_super(sb);
-
        mutex_lock(&c->alloc_sem);
        jffs2_flush_wbuf_pad(c);
        mutex_unlock(&c->alloc_sem);
@@ -215,8 +199,8 @@ static int jffs2_parse_options(struct jffs2_sb_info *c, char *data)
                                                JFFS2_COMPR_MODE_FORCEZLIB;
 #endif
                        else {
-                               printk(KERN_ERR "JFFS2 Error: unknown compressor \"%s\"",
-                                               name);
+                               pr_err("Error: unknown compressor \"%s\"\n",
+                                      name);
                                kfree(name);
                                return -EINVAL;
                        }
@@ -224,8 +208,8 @@ static int jffs2_parse_options(struct jffs2_sb_info *c, char *data)
                        c->mount_opts.override_compr = true;
                        break;
                default:
-                       printk(KERN_ERR "JFFS2 Error: unrecognized mount option '%s' or missing value\n",
-                                       p);
+                       pr_err("Error: unrecognized mount option '%s' or missing value\n",
+                              p);
                        return -EINVAL;
                }
        }
@@ -250,7 +234,6 @@ static const struct super_operations jffs2_super_operations =
        .alloc_inode =  jffs2_alloc_inode,
        .destroy_inode =jffs2_destroy_inode,
        .put_super =    jffs2_put_super,
-       .write_super =  jffs2_write_super,
        .statfs =       jffs2_statfs,
        .remount_fs =   jffs2_remount_fs,
        .evict_inode =  jffs2_evict_inode,
@@ -267,9 +250,9 @@ static int jffs2_fill_super(struct super_block *sb, void *data, int silent)
        struct jffs2_sb_info *c;
        int ret;
 
-       D1(printk(KERN_DEBUG "jffs2_get_sb_mtd():"
+       jffs2_dbg(1, "jffs2_get_sb_mtd():"
                  " New superblock for device %d (\"%s\")\n",
-                 sb->s_mtd->index, sb->s_mtd->name));
+                 sb->s_mtd->index, sb->s_mtd->name);
 
        c = kzalloc(sizeof(*c), GFP_KERNEL);
        if (!c)
@@ -316,10 +299,7 @@ static void jffs2_put_super (struct super_block *sb)
 {
        struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
 
-       D2(printk(KERN_DEBUG "jffs2: jffs2_put_super()\n"));
-
-       if (sb->s_dirt)
-               jffs2_write_super(sb);
+       jffs2_dbg(2, "%s()\n", __func__);
 
        mutex_lock(&c->alloc_sem);
        jffs2_flush_wbuf_pad(c);
@@ -336,10 +316,8 @@ static void jffs2_put_super (struct super_block *sb)
        jffs2_flash_cleanup(c);
        kfree(c->inocache_list);
        jffs2_clear_xattr_subsystem(c);
-       if (c->mtd->sync)
-               c->mtd->sync(c->mtd);
-
-       D1(printk(KERN_DEBUG "jffs2_put_super returning\n"));
+       mtd_sync(c->mtd);
+       jffs2_dbg(1, "%s(): returning\n", __func__);
 }
 
 static void jffs2_kill_sb(struct super_block *sb)
@@ -374,7 +352,7 @@ static int __init init_jffs2_fs(void)
        BUILD_BUG_ON(sizeof(struct jffs2_raw_inode) != 68);
        BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32);
 
-       printk(KERN_INFO "JFFS2 version 2.2."
+       pr_info("version 2.2."
 #ifdef CONFIG_JFFS2_FS_WRITEBUFFER
               " (NAND)"
 #endif
@@ -389,22 +367,22 @@ static int __init init_jffs2_fs(void)
                                                SLAB_MEM_SPREAD),
                                             jffs2_i_init_once);
        if (!jffs2_inode_cachep) {
-               printk(KERN_ERR "JFFS2 error: Failed to initialise inode cache\n");
+               pr_err("error: Failed to initialise inode cache\n");
                return -ENOMEM;
        }
        ret = jffs2_compressors_init();
        if (ret) {
-               printk(KERN_ERR "JFFS2 error: Failed to initialise compressors\n");
+               pr_err("error: Failed to initialise compressors\n");
                goto out;
        }
        ret = jffs2_create_slab_caches();
        if (ret) {
-               printk(KERN_ERR "JFFS2 error: Failed to initialise slab caches\n");
+               pr_err("error: Failed to initialise slab caches\n");
                goto out_compressors;
        }
        ret = register_filesystem(&jffs2_fs_type);
        if (ret) {
-               printk(KERN_ERR "JFFS2 error: Failed to register filesystem\n");
+               pr_err("error: Failed to register filesystem\n");
                goto out_slab;
        }
        return 0;