]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/f2fs/super.c
Merge tag 'soc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[karo-tx-linux.git] / fs / f2fs / super.c
index 66d1ec137e4474c14fea33edb0fea554a9198c05..13d0a0fe49dd413ed70d3a10dc864d27bea5c79a 100644 (file)
@@ -47,6 +47,7 @@ enum {
        Opt_noacl,
        Opt_active_logs,
        Opt_disable_ext_identify,
+       Opt_inline_xattr,
        Opt_err,
 };
 
@@ -59,6 +60,7 @@ static match_table_t f2fs_tokens = {
        {Opt_noacl, "noacl"},
        {Opt_active_logs, "active_logs=%u"},
        {Opt_disable_ext_identify, "disable_ext_identify"},
+       {Opt_inline_xattr, "inline_xattr"},
        {Opt_err, NULL},
 };
 
@@ -238,11 +240,18 @@ static int parse_options(struct super_block *sb, char *options)
                case Opt_nouser_xattr:
                        clear_opt(sbi, XATTR_USER);
                        break;
+               case Opt_inline_xattr:
+                       set_opt(sbi, INLINE_XATTR);
+                       break;
 #else
                case Opt_nouser_xattr:
                        f2fs_msg(sb, KERN_INFO,
                                "nouser_xattr options not supported");
                        break;
+               case Opt_inline_xattr:
+                       f2fs_msg(sb, KERN_INFO,
+                               "inline_xattr options not supported");
+                       break;
 #endif
 #ifdef CONFIG_F2FS_FS_POSIX_ACL
                case Opt_noacl:
@@ -292,6 +301,9 @@ static struct inode *f2fs_alloc_inode(struct super_block *sb)
 
        set_inode_flag(fi, FI_NEW_INODE);
 
+       if (test_opt(F2FS_SB(sb), INLINE_XATTR))
+               set_inode_flag(fi, FI_INLINE_XATTR);
+
        return &fi->vfs_inode;
 }
 
@@ -317,7 +329,6 @@ static int f2fs_drop_inode(struct inode *inode)
 static void f2fs_dirty_inode(struct inode *inode, int flags)
 {
        set_inode_flag(F2FS_I(inode), FI_DIRTY_INODE);
-       return;
 }
 
 static void f2fs_i_callback(struct rcu_head *head)
@@ -445,6 +456,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
                seq_puts(seq, ",user_xattr");
        else
                seq_puts(seq, ",nouser_xattr");
+       if (test_opt(sbi, INLINE_XATTR))
+               seq_puts(seq, ",inline_xattr");
 #endif
 #ifdef CONFIG_F2FS_FS_POSIX_ACL
        if (test_opt(sbi, POSIX_ACL))
@@ -605,7 +618,7 @@ static const struct export_operations f2fs_export_ops = {
 
 static loff_t max_file_size(unsigned bits)
 {
-       loff_t result = ADDRS_PER_INODE;
+       loff_t result = (DEF_ADDRS_PER_INODE - F2FS_INLINE_XATTR_ADDRS);
        loff_t leaf_count = ADDRS_PER_BLOCK;
 
        /* two direct node blocks */
@@ -1005,21 +1018,35 @@ static int __init init_f2fs_fs(void)
                goto fail;
        err = create_node_manager_caches();
        if (err)
-               goto fail;
+               goto free_inodecache;
        err = create_gc_caches();
        if (err)
-               goto fail;
+               goto free_node_manager_caches;
        err = create_checkpoint_caches();
        if (err)
-               goto fail;
+               goto free_gc_caches;
        f2fs_kset = kset_create_and_add("f2fs", NULL, fs_kobj);
-       if (!f2fs_kset)
-               goto fail;
+       if (!f2fs_kset) {
+               err = -ENOMEM;
+               goto free_checkpoint_caches;
+       }
        err = register_filesystem(&f2fs_fs_type);
        if (err)
-               goto fail;
+               goto free_kset;
        f2fs_create_root_stats();
        f2fs_proc_root = proc_mkdir("fs/f2fs", NULL);
+       return 0;
+
+free_kset:
+       kset_unregister(f2fs_kset);
+free_checkpoint_caches:
+       destroy_checkpoint_caches();
+free_gc_caches:
+       destroy_gc_caches();
+free_node_manager_caches:
+       destroy_node_manager_caches();
+free_inodecache:
+       destroy_inodecache();
 fail:
        return err;
 }