btrfs: fix string and comment grammatical issues and typos
[deliverable/linux.git] / fs / btrfs / super.c
index d41e09fe8e38d77674862c7fe61f610a81d1159d..01ef1865db63fe0024e80df4a57b16b20e0584da 100644 (file)
@@ -121,7 +121,7 @@ static void btrfs_handle_error(struct btrfs_fs_info *fs_info)
                 * Note that a running device replace operation is not
                 * canceled here although there is no way to update
                 * the progress. It would add the risk of a deadlock,
-                * therefore the canceling is ommited. The only penalty
+                * therefore the canceling is omitted. The only penalty
                 * is that some I/O remains active until the procedure
                 * completes. The next time when the filesystem is
                 * mounted writeable again, the device replace
@@ -303,7 +303,8 @@ enum {
        Opt_check_integrity_print_mask, Opt_fatal_errors, Opt_rescan_uuid_tree,
        Opt_commit_interval, Opt_barrier, Opt_nodefrag, Opt_nodiscard,
        Opt_noenospc_debug, Opt_noflushoncommit, Opt_acl, Opt_datacow,
-       Opt_datasum, Opt_treelog, Opt_noinode_cache,
+       Opt_datasum, Opt_treelog, Opt_noinode_cache, Opt_usebackuproot,
+       Opt_nologreplay, Opt_norecovery,
 #ifdef CONFIG_BTRFS_DEBUG
        Opt_fragment_data, Opt_fragment_metadata, Opt_fragment_all,
 #endif
@@ -335,6 +336,8 @@ static const match_table_t tokens = {
        {Opt_noacl, "noacl"},
        {Opt_notreelog, "notreelog"},
        {Opt_treelog, "treelog"},
+       {Opt_nologreplay, "nologreplay"},
+       {Opt_norecovery, "norecovery"},
        {Opt_flushoncommit, "flushoncommit"},
        {Opt_noflushoncommit, "noflushoncommit"},
        {Opt_ratio, "metadata_ratio=%d"},
@@ -352,7 +355,8 @@ static const match_table_t tokens = {
        {Opt_inode_cache, "inode_cache"},
        {Opt_noinode_cache, "noinode_cache"},
        {Opt_no_space_cache, "nospace_cache"},
-       {Opt_recovery, "recovery"},
+       {Opt_recovery, "recovery"}, /* deprecated */
+       {Opt_usebackuproot, "usebackuproot"},
        {Opt_skip_balance, "skip_balance"},
        {Opt_check_integrity, "check_int"},
        {Opt_check_integrity_including_extent_data, "check_int_data"},
@@ -373,7 +377,8 @@ static const match_table_t tokens = {
  * reading in a new superblock is parsed here.
  * XXX JDM: This needs to be cleaned up for remount.
  */
-int btrfs_parse_options(struct btrfs_root *root, char *options)
+int btrfs_parse_options(struct btrfs_root *root, char *options,
+                       unsigned long new_flags)
 {
        struct btrfs_fs_info *info = root->fs_info;
        substring_t args[MAX_OPT_ARGS];
@@ -393,8 +398,12 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
        else if (cache_gen)
                btrfs_set_opt(info->mount_opt, SPACE_CACHE);
 
+       /*
+        * Even the options are empty, we still need to do extra check
+        * against new flags
+        */
        if (!options)
-               goto out;
+               goto check;
 
        /*
         * strsep changes the string, duplicate it because parse_options
@@ -606,6 +615,11 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
                        btrfs_clear_and_info(root, NOTREELOG,
                                             "enabling tree log");
                        break;
+               case Opt_norecovery:
+               case Opt_nologreplay:
+                       btrfs_set_and_info(root, NOLOGREPLAY,
+                                          "disabling log replay at mount time");
+                       break;
                case Opt_flushoncommit:
                        btrfs_set_and_info(root, FLUSHONCOMMIT,
                                           "turning on flush-on-commit");
@@ -696,8 +710,12 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
                                             "disabling auto defrag");
                        break;
                case Opt_recovery:
-                       btrfs_info(root->fs_info, "enabling auto recovery");
-                       btrfs_set_opt(info->mount_opt, RECOVERY);
+                       btrfs_warn(root->fs_info,
+                                  "'recovery' is deprecated, use 'usebackuproot' instead");
+               case Opt_usebackuproot:
+                       btrfs_info(root->fs_info,
+                                  "trying to use backup root at mount time");
+                       btrfs_set_opt(info->mount_opt, USEBACKUPROOT);
                        break;
                case Opt_skip_balance:
                        btrfs_set_opt(info->mount_opt, SKIP_BALANCE);
@@ -792,6 +810,15 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
                        break;
                }
        }
+check:
+       /*
+        * Extra check for current option against current flag
+        */
+       if (btrfs_test_opt(root, NOLOGREPLAY) && !(new_flags & MS_RDONLY)) {
+               btrfs_err(root->fs_info,
+                         "nologreplay must be used with ro mount option");
+               ret = -EINVAL;
+       }
 out:
        if (btrfs_fs_compat_ro(root->fs_info, FREE_SPACE_TREE) &&
            !btrfs_test_opt(root, FREE_SPACE_TREE) &&
@@ -1202,6 +1229,8 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
                seq_puts(seq, ",ssd");
        if (btrfs_test_opt(root, NOTREELOG))
                seq_puts(seq, ",notreelog");
+       if (btrfs_test_opt(root, NOLOGREPLAY))
+               seq_puts(seq, ",nologreplay");
        if (btrfs_test_opt(root, FLUSHONCOMMIT))
                seq_puts(seq, ",flushoncommit");
        if (btrfs_test_opt(root, DISCARD))
@@ -1228,8 +1257,6 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
                seq_puts(seq, ",inode_cache");
        if (btrfs_test_opt(root, SKIP_BALANCE))
                seq_puts(seq, ",skip_balance");
-       if (btrfs_test_opt(root, RECOVERY))
-               seq_puts(seq, ",recovery");
 #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
        if (btrfs_test_opt(root, CHECK_INTEGRITY_INCLUDING_EXTENT_DATA))
                seq_puts(seq, ",check_int_data");
@@ -1685,7 +1712,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
                }
        }
 
-       ret = btrfs_parse_options(root, data);
+       ret = btrfs_parse_options(root, data, *flags);
        if (ret) {
                ret = -EINVAL;
                goto restore;
@@ -1854,7 +1881,7 @@ static int btrfs_calc_avail_data_space(struct btrfs_root *root, u64 *free_bytes)
        int ret;
 
        /*
-        * We aren't under the device list lock, so this is racey-ish, but good
+        * We aren't under the device list lock, so this is racy-ish, but good
         * enough for our purposes.
         */
        nr_devices = fs_info->fs_devices->open_devices;
@@ -1873,7 +1900,7 @@ static int btrfs_calc_avail_data_space(struct btrfs_root *root, u64 *free_bytes)
        if (!devices_info)
                return -ENOMEM;
 
-       /* calc min stripe number for data space alloction */
+       /* calc min stripe number for data space allocation */
        type = btrfs_get_alloc_profile(root, 1);
        if (type & BTRFS_BLOCK_GROUP_RAID0) {
                min_stripes = 2;
@@ -1909,7 +1936,7 @@ static int btrfs_calc_avail_data_space(struct btrfs_root *root, u64 *free_bytes)
                avail_space *= BTRFS_STRIPE_LEN;
 
                /*
-                * In order to avoid overwritting the superblock on the drive,
+                * In order to avoid overwriting the superblock on the drive,
                 * btrfs starts at an offset of at least 1MB when doing chunk
                 * allocation.
                 */
@@ -2163,6 +2190,9 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
                        break;
                ret = !(fs_devices->num_devices == fs_devices->total_devices);
                break;
+       case BTRFS_IOC_GET_SUPPORTED_FEATURES:
+               ret = btrfs_ioctl_get_supported_features((void __user*)arg);
+               break;
        }
 
        kfree(vol);
@@ -2261,7 +2291,7 @@ static void btrfs_interface_exit(void)
        misc_deregister(&btrfs_misc);
 }
 
-static void btrfs_print_info(void)
+static void btrfs_print_mod_info(void)
 {
        printk(KERN_INFO "Btrfs loaded"
 #ifdef CONFIG_BTRFS_DEBUG
@@ -2363,7 +2393,7 @@ static int __init init_btrfs_fs(void)
 
        btrfs_init_lockdep();
 
-       btrfs_print_info();
+       btrfs_print_mod_info();
 
        err = btrfs_run_sanity_tests();
        if (err)
This page took 0.035736 seconds and 5 git commands to generate.