btrfs: add a comment to mark the deprecated mount option
[sfrench/cifs-2.6.git] / fs / btrfs / super.c
index 6e71a2a783630ac15d2d910fd0613347c4a260ac..540c18511e7a8663065832f9b37574e173207918 100644 (file)
@@ -344,8 +344,8 @@ static const match_table_t tokens = {
        {Opt_nobarrier, "nobarrier"},
        {Opt_barrier, "barrier"},
        {Opt_max_inline, "max_inline=%s"},
-       {Opt_alloc_start, "alloc_start=%s"},
-       {Opt_thread_pool, "thread_pool=%d"},
+       {Opt_alloc_start, "alloc_start=%s"},            /* deprecated */
+       {Opt_thread_pool, "thread_pool=%u"},
        {Opt_compress, "compress"},
        {Opt_compress_type, "compress=%s"},
        {Opt_compress_force, "compress-force"},
@@ -361,7 +361,7 @@ static const match_table_t tokens = {
        {Opt_norecovery, "norecovery"},
        {Opt_flushoncommit, "flushoncommit"},
        {Opt_noflushoncommit, "noflushoncommit"},
-       {Opt_ratio, "metadata_ratio=%d"},
+       {Opt_ratio, "metadata_ratio=%u"},
        {Opt_discard, "discard"},
        {Opt_nodiscard, "nodiscard"},
        {Opt_space_cache, "space_cache"},
@@ -370,7 +370,7 @@ static const match_table_t tokens = {
        {Opt_user_subvol_rm_allowed, "user_subvol_rm_allowed"},
        {Opt_enospc_debug, "enospc_debug"},
        {Opt_noenospc_debug, "noenospc_debug"},
-       {Opt_subvolrootid, "subvolrootid=%d"},
+       {Opt_subvolrootid, "subvolrootid=%d"},          /* deprecated */
        {Opt_defrag, "autodefrag"},
        {Opt_nodefrag, "noautodefrag"},
        {Opt_inode_cache, "inode_cache"},
@@ -381,10 +381,10 @@ static const match_table_t tokens = {
        {Opt_skip_balance, "skip_balance"},
        {Opt_check_integrity, "check_int"},
        {Opt_check_integrity_including_extent_data, "check_int_data"},
-       {Opt_check_integrity_print_mask, "check_int_print_mask=%d"},
+       {Opt_check_integrity_print_mask, "check_int_print_mask=%u"},
        {Opt_rescan_uuid_tree, "rescan_uuid_tree"},
        {Opt_fatal_errors, "fatal_errors=%s"},
-       {Opt_commit_interval, "commit=%d"},
+       {Opt_commit_interval, "commit=%u"},
 #ifdef CONFIG_BTRFS_DEBUG
        {Opt_fragment_data, "fragment=data"},
        {Opt_fragment_metadata, "fragment=metadata"},
@@ -594,12 +594,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
                        ret = match_int(&args[0], &intarg);
                        if (ret) {
                                goto out;
-                       } else if (intarg > 0) {
-                               info->thread_pool_size = intarg;
-                       } else {
+                       } else if (intarg == 0) {
                                ret = -EINVAL;
                                goto out;
                        }
+                       info->thread_pool_size = intarg;
                        break;
                case Opt_max_inline:
                        num = match_strdup(&args[0]);
@@ -658,16 +657,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
                        break;
                case Opt_ratio:
                        ret = match_int(&args[0], &intarg);
-                       if (ret) {
-                               goto out;
-                       } else if (intarg >= 0) {
-                               info->metadata_ratio = intarg;
-                               btrfs_info(info, "metadata ratio %d",
-                                          info->metadata_ratio);
-                       } else {
-                               ret = -EINVAL;
+                       if (ret)
                                goto out;
-                       }
+                       info->metadata_ratio = intarg;
+                       btrfs_info(info, "metadata ratio %u",
+                                  info->metadata_ratio);
                        break;
                case Opt_discard:
                        btrfs_set_and_info(info, DISCARD,
@@ -762,17 +756,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
                        break;
                case Opt_check_integrity_print_mask:
                        ret = match_int(&args[0], &intarg);
-                       if (ret) {
+                       if (ret)
                                goto out;
-                       } else if (intarg >= 0) {
-                               info->check_integrity_print_mask = intarg;
-                               btrfs_info(info,
-                                          "check_integrity_print_mask 0x%x",
-                                          info->check_integrity_print_mask);
-                       } else {
-                               ret = -EINVAL;
-                               goto out;
-                       }
+                       info->check_integrity_print_mask = intarg;
+                       btrfs_info(info, "check_integrity_print_mask 0x%x",
+                                  info->check_integrity_print_mask);
                        break;
 #else
                case Opt_check_integrity_including_extent_data:
@@ -798,24 +786,18 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
                case Opt_commit_interval:
                        intarg = 0;
                        ret = match_int(&args[0], &intarg);
-                       if (ret < 0) {
-                               btrfs_err(info, "invalid commit interval");
-                               ret = -EINVAL;
+                       if (ret)
                                goto out;
-                       }
-                       if (intarg > 0) {
-                               if (intarg > 300) {
-                                       btrfs_warn(info,
-                                               "excessive commit interval %d",
-                                               intarg);
-                               }
-                               info->commit_interval = intarg;
-                       } else {
+                       if (intarg == 0) {
                                btrfs_info(info,
-                                          "using default commit interval %ds",
+                                          "using default commit interval %us",
                                           BTRFS_DEFAULT_COMMIT_INTERVAL);
-                               info->commit_interval = BTRFS_DEFAULT_COMMIT_INTERVAL;
+                               intarg = BTRFS_DEFAULT_COMMIT_INTERVAL;
+                       } else if (intarg > 300) {
+                               btrfs_warn(info, "excessive commit interval %d",
+                                          intarg);
                        }
+                       info->commit_interval = intarg;
                        break;
 #ifdef CONFIG_BTRFS_DEBUG
                case Opt_fragment_all:
@@ -1284,7 +1266,7 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
                seq_printf(seq, ",max_inline=%llu", info->max_inline);
        if (info->thread_pool_size !=  min_t(unsigned long,
                                             num_online_cpus() + 2, 8))
-               seq_printf(seq, ",thread_pool=%d", info->thread_pool_size);
+               seq_printf(seq, ",thread_pool=%u", info->thread_pool_size);
        if (btrfs_test_opt(info, COMPRESS)) {
                compress_type = btrfs_compress_type2str(info->compress_type);
                if (btrfs_test_opt(info, FORCE_COMPRESS))
@@ -1340,12 +1322,11 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
                                info->check_integrity_print_mask);
 #endif
        if (info->metadata_ratio)
-               seq_printf(seq, ",metadata_ratio=%d",
-                               info->metadata_ratio);
+               seq_printf(seq, ",metadata_ratio=%u", info->metadata_ratio);
        if (btrfs_test_opt(info, PANIC_ON_FATAL_ERROR))
                seq_puts(seq, ",fatal_errors=panic");
        if (info->commit_interval != BTRFS_DEFAULT_COMMIT_INTERVAL)
-               seq_printf(seq, ",commit=%d", info->commit_interval);
+               seq_printf(seq, ",commit=%u", info->commit_interval);
 #ifdef CONFIG_BTRFS_DEBUG
        if (btrfs_test_opt(info, FRAGMENT_DATA))
                seq_puts(seq, ",fragment=data");
@@ -1545,7 +1526,7 @@ static struct dentry *btrfs_mount_root(struct file_system_type *fs_type,
         * it for searching for existing supers, so this lets us do that and
         * then open_ctree will properly initialize everything later.
         */
-       fs_info = kzalloc(sizeof(struct btrfs_fs_info), GFP_KERNEL);
+       fs_info = kvzalloc(sizeof(struct btrfs_fs_info), GFP_KERNEL);
        if (!fs_info) {
                error = -ENOMEM;
                goto error_sec_opts;
@@ -1690,7 +1671,7 @@ out:
 }
 
 static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info,
-                                    int new_pool_size, int old_pool_size)
+                                    u32 new_pool_size, u32 old_pool_size)
 {
        if (new_pool_size == old_pool_size)
                return;
@@ -1758,7 +1739,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
        unsigned long old_opts = fs_info->mount_opt;
        unsigned long old_compress_type = fs_info->compress_type;
        u64 old_max_inline = fs_info->max_inline;
-       int old_thread_pool_size = fs_info->thread_pool_size;
+       u32 old_thread_pool_size = fs_info->thread_pool_size;
        unsigned int old_metadata_ratio = fs_info->metadata_ratio;
        int ret;