]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/f2fs/super.c
Merge tag 'for-linus-20190420' of git://git.kernel.dk/linux-block
[linux.git] / fs / f2fs / super.c
index 45121190a2ba485f01b6d1151bb466b762e4149a..f2aaa2cc6b3e01e88a7aeea026cfaa97f73ae1de 100644 (file)
@@ -757,7 +757,7 @@ static int parse_options(struct super_block *sb, char *options)
                        kvfree(name);
                        break;
                case Opt_test_dummy_encryption:
-#ifdef CONFIG_F2FS_FS_ENCRYPTION
+#ifdef CONFIG_FS_ENCRYPTION
                        if (!f2fs_sb_has_encrypt(sbi)) {
                                f2fs_msg(sb, KERN_ERR, "Encrypt feature is off");
                                return -EINVAL;
@@ -821,6 +821,8 @@ static int parse_options(struct super_block *sb, char *options)
        }
 
        if (test_opt(sbi, INLINE_XATTR_SIZE)) {
+               int min_size, max_size;
+
                if (!f2fs_sb_has_extra_attr(sbi) ||
                        !f2fs_sb_has_flexible_inline_xattr(sbi)) {
                        f2fs_msg(sb, KERN_ERR,
@@ -834,15 +836,15 @@ static int parse_options(struct super_block *sb, char *options)
                                        "set with inline_xattr option");
                        return -EINVAL;
                }
-               if (F2FS_OPTION(sbi).inline_xattr_size <
-                       sizeof(struct f2fs_xattr_header) / sizeof(__le32) ||
-                       F2FS_OPTION(sbi).inline_xattr_size >
-                       DEF_ADDRS_PER_INODE -
-                       F2FS_TOTAL_EXTRA_ATTR_SIZE / sizeof(__le32) -
-                       DEF_INLINE_RESERVED_SIZE -
-                       MIN_INLINE_DENTRY_SIZE / sizeof(__le32)) {
+
+               min_size = sizeof(struct f2fs_xattr_header) / sizeof(__le32);
+               max_size = MAX_INLINE_XATTR_SIZE;
+
+               if (F2FS_OPTION(sbi).inline_xattr_size < min_size ||
+                               F2FS_OPTION(sbi).inline_xattr_size > max_size) {
                        f2fs_msg(sb, KERN_ERR,
-                                       "inline xattr size is out of range");
+                               "inline xattr size is out of range: %d ~ %d",
+                               min_size, max_size);
                        return -EINVAL;
                }
        }
@@ -1398,7 +1400,7 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
                seq_printf(seq, ",whint_mode=%s", "user-based");
        else if (F2FS_OPTION(sbi).whint_mode == WHINT_MODE_FS)
                seq_printf(seq, ",whint_mode=%s", "fs-based");
-#ifdef CONFIG_F2FS_FS_ENCRYPTION
+#ifdef CONFIG_FS_ENCRYPTION
        if (F2FS_OPTION(sbi).test_dummy_encryption)
                seq_puts(seq, ",test_dummy_encryption");
 #endif
@@ -2183,7 +2185,7 @@ static const struct super_operations f2fs_sops = {
        .remount_fs     = f2fs_remount,
 };
 
-#ifdef CONFIG_F2FS_FS_ENCRYPTION
+#ifdef CONFIG_FS_ENCRYPTION
 static int f2fs_get_context(struct inode *inode, void *ctx, size_t len)
 {
        return f2fs_getxattr(inode, F2FS_XATTR_INDEX_ENCRYPTION,
@@ -3129,7 +3131,6 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
        sb->s_maxbytes = sbi->max_file_blocks <<
                                le32_to_cpu(raw_super->log_blocksize);
        sb->s_max_links = F2FS_LINK_MAX;
-       get_random_bytes(&sbi->s_next_generation, sizeof(u32));
 
 #ifdef CONFIG_QUOTA
        sb->dq_op = &f2fs_quota_operations;
@@ -3148,7 +3149,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 #endif
 
        sb->s_op = &f2fs_sops;
-#ifdef CONFIG_F2FS_FS_ENCRYPTION
+#ifdef CONFIG_FS_ENCRYPTION
        sb->s_cop = &f2fs_cryptops;
 #endif
        sb->s_xattr = f2fs_xattr_handlers;