f2fs: compress: support chksum
[platform/kernel/linux-rpi.git] / fs / f2fs / super.c
index 0c958fe..f3d919e 100644 (file)
@@ -146,6 +146,7 @@ enum {
        Opt_compress_algorithm,
        Opt_compress_log_size,
        Opt_compress_extension,
+       Opt_compress_chksum,
        Opt_atgc,
        Opt_err,
 };
@@ -214,6 +215,7 @@ static match_table_t f2fs_tokens = {
        {Opt_compress_algorithm, "compress_algorithm=%s"},
        {Opt_compress_log_size, "compress_log_size=%u"},
        {Opt_compress_extension, "compress_extension=%s"},
+       {Opt_compress_chksum, "compress_chksum"},
        {Opt_atgc, "atgc"},
        {Opt_err, NULL},
 };
@@ -934,10 +936,14 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
                        F2FS_OPTION(sbi).compress_ext_cnt++;
                        kfree(name);
                        break;
+               case Opt_compress_chksum:
+                       F2FS_OPTION(sbi).compress_chksum = true;
+                       break;
 #else
                case Opt_compress_algorithm:
                case Opt_compress_log_size:
                case Opt_compress_extension:
+               case Opt_compress_chksum:
                        f2fs_info(sbi, "compression options not supported");
                        break;
 #endif
@@ -1442,8 +1448,7 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf)
        }
 
        buf->f_namelen = F2FS_NAME_LEN;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid    = u64_to_fsid(id);
 
 #ifdef CONFIG_QUOTA
        if (is_inode_flag_set(dentry->d_inode, FI_PROJ_INHERIT) &&
@@ -1524,6 +1529,9 @@ static inline void f2fs_show_compress_options(struct seq_file *seq,
                seq_printf(seq, ",compress_extension=%s",
                        F2FS_OPTION(sbi).extensions[i]);
        }
+
+       if (F2FS_OPTION(sbi).compress_chksum)
+               seq_puts(seq, ",compress_chksum");
 }
 
 static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
@@ -1905,7 +1913,6 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
 
        if (*flags & SB_RDONLY ||
                F2FS_OPTION(sbi).whint_mode != org_mount_opt.whint_mode) {
-               writeback_inodes_sb(sb, WB_REASON_SYNC);
                sync_inodes_sb(sb);
 
                set_sbi_flag(sbi, SBI_IS_DIRTY);
@@ -3400,12 +3407,6 @@ static int f2fs_setup_casefold(struct f2fs_sb_info *sbi)
                struct unicode_map *encoding;
                __u16 encoding_flags;
 
-               if (f2fs_sb_has_encrypt(sbi)) {
-                       f2fs_err(sbi,
-                               "Can't mount with encoding and encryption");
-                       return -EINVAL;
-               }
-
                if (f2fs_sb_read_encoding(sbi->raw_super, &encoding_info,
                                          &encoding_flags)) {
                        f2fs_err(sbi,
@@ -3428,7 +3429,6 @@ static int f2fs_setup_casefold(struct f2fs_sb_info *sbi)
 
                sbi->sb->s_encoding = encoding;
                sbi->sb->s_encoding_flags = encoding_flags;
-               sbi->sb->s_d_op = &f2fs_dentry_ops;
        }
 #else
        if (f2fs_sb_has_casefold(sbi)) {
@@ -3560,7 +3560,7 @@ try_onemore:
        sbi->valid_super_block = valid_super_block;
        init_rwsem(&sbi->gc_lock);
        mutex_init(&sbi->writepages);
-       mutex_init(&sbi->cp_mutex);
+       init_rwsem(&sbi->cp_global_sem);
        init_rwsem(&sbi->node_write);
        init_rwsem(&sbi->node_change);
 
@@ -3919,6 +3919,7 @@ free_bio_info:
 
 #ifdef CONFIG_UNICODE
        utf8_unload(sb->s_encoding);
+       sb->s_encoding = NULL;
 #endif
 free_options:
 #ifdef CONFIG_QUOTA