btrfs: qgroup: simple quota auto hierarchy for nested subvolumes
[linux-2.6-microblaze.git] / fs / btrfs / super.c
index f49e597..55d308c 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/ratelimit.h>
 #include <linux/crc32c.h>
 #include <linux/btrfs.h>
+#include <linux/security.h>
 #include "messages.h"
 #include "delayed-inode.h"
 #include "ctree.h"
@@ -129,9 +130,6 @@ enum {
        Opt_inode_cache, Opt_noinode_cache,
 
        /* Debugging options */
-       Opt_check_integrity,
-       Opt_check_integrity_including_extent_data,
-       Opt_check_integrity_print_mask,
        Opt_enospc_debug, Opt_noenospc_debug,
 #ifdef CONFIG_BTRFS_DEBUG
        Opt_fragment_data, Opt_fragment_metadata, Opt_fragment_all,
@@ -200,9 +198,6 @@ static const match_table_t tokens = {
        {Opt_recovery, "recovery"},
 
        /* Debugging options */
-       {Opt_check_integrity, "check_int"},
-       {Opt_check_integrity_including_extent_data, "check_int_data"},
-       {Opt_check_integrity_print_mask, "check_int_print_mask=%u"},
        {Opt_enospc_debug, "enospc_debug"},
        {Opt_noenospc_debug, "noenospc_debug"},
 #ifdef CONFIG_BTRFS_DEBUG
@@ -707,44 +702,6 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
                case Opt_skip_balance:
                        btrfs_set_opt(info->mount_opt, SKIP_BALANCE);
                        break;
-#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
-               case Opt_check_integrity_including_extent_data:
-                       btrfs_warn(info,
-       "integrity checker is deprecated and will be removed in 6.7");
-                       btrfs_info(info,
-                                  "enabling check integrity including extent data");
-                       btrfs_set_opt(info->mount_opt, CHECK_INTEGRITY_DATA);
-                       btrfs_set_opt(info->mount_opt, CHECK_INTEGRITY);
-                       break;
-               case Opt_check_integrity:
-                       btrfs_warn(info,
-       "integrity checker is deprecated and will be removed in 6.7");
-                       btrfs_info(info, "enabling check integrity");
-                       btrfs_set_opt(info->mount_opt, CHECK_INTEGRITY);
-                       break;
-               case Opt_check_integrity_print_mask:
-                       ret = match_int(&args[0], &intarg);
-                       if (ret) {
-                               btrfs_err(info,
-                               "unrecognized check_integrity_print_mask value %s",
-                                       args[0].from);
-                               goto out;
-                       }
-                       info->check_integrity_print_mask = intarg;
-                       btrfs_warn(info,
-       "integrity checker is deprecated and will be removed in 6.7");
-                       btrfs_info(info, "check_integrity_print_mask 0x%x",
-                                  info->check_integrity_print_mask);
-                       break;
-#else
-               case Opt_check_integrity_including_extent_data:
-               case Opt_check_integrity:
-               case Opt_check_integrity_print_mask:
-                       btrfs_err(info,
-                                 "support for check_integrity* not compiled in!");
-                       ret = -EINVAL;
-                       goto out;
-#endif
                case Opt_fatal_errors:
                        if (strcmp(args[0].from, "panic") == 0) {
                                btrfs_set_opt(info->mount_opt,
@@ -889,7 +846,7 @@ static int btrfs_parse_device_options(const char *options, blk_mode_t flags)
                                error = -ENOMEM;
                                goto out;
                        }
-                       device = btrfs_scan_one_device(device_name, flags);
+                       device = btrfs_scan_one_device(device_name, flags, false);
                        kfree(device_name);
                        if (IS_ERR(device)) {
                                error = PTR_ERR(device);
@@ -954,10 +911,6 @@ static int btrfs_parse_subvol_options(const char *options, char **subvol_name,
 
                        *subvol_objectid = subvolid;
                        break;
-               case Opt_err:
-                       btrfs_err(NULL, "unrecognized mount option '%s'", p);
-                       error = -EINVAL;
-                       goto out;
                default:
                        break;
                }
@@ -1309,15 +1262,6 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
                seq_puts(seq, ",autodefrag");
        if (btrfs_test_opt(info, SKIP_BALANCE))
                seq_puts(seq, ",skip_balance");
-#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
-       if (btrfs_test_opt(info, CHECK_INTEGRITY_DATA))
-               seq_puts(seq, ",check_int_data");
-       else if (btrfs_test_opt(info, CHECK_INTEGRITY))
-               seq_puts(seq, ",check_int");
-       if (info->check_integrity_print_mask)
-               seq_printf(seq, ",check_int_print_mask=%d",
-                               info->check_integrity_print_mask);
-#endif
        if (info->metadata_ratio)
                seq_printf(seq, ",metadata_ratio=%u", info->metadata_ratio);
        if (btrfs_test_opt(info, PANIC_ON_FATAL_ERROR))
@@ -1488,7 +1432,12 @@ static struct dentry *btrfs_mount_root(struct file_system_type *fs_type,
                goto error_fs_info;
        }
 
-       device = btrfs_scan_one_device(device_name, mode);
+       /*
+        * With 'true' passed to btrfs_scan_one_device() (mount time) we expect
+        * either a valid device or an error.
+        */
+       device = btrfs_scan_one_device(device_name, mode, true);
+       ASSERT(device != NULL);
        if (IS_ERR(device)) {
                mutex_unlock(&uuid_mutex);
                error = PTR_ERR(device);
@@ -2200,7 +2149,11 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
        switch (cmd) {
        case BTRFS_IOC_SCAN_DEV:
                mutex_lock(&uuid_mutex);
-               device = btrfs_scan_one_device(vol->name, BLK_OPEN_READ);
+               /*
+                * Scanning outside of mount can return NULL which would turn
+                * into 0 error code.
+                */
+               device = btrfs_scan_one_device(vol->name, BLK_OPEN_READ, false);
                ret = PTR_ERR_OR_ZERO(device);
                mutex_unlock(&uuid_mutex);
                break;
@@ -2214,8 +2167,12 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
                break;
        case BTRFS_IOC_DEVICES_READY:
                mutex_lock(&uuid_mutex);
-               device = btrfs_scan_one_device(vol->name, BLK_OPEN_READ);
-               if (IS_ERR(device)) {
+               /*
+                * Scanning outside of mount can return NULL which would turn
+                * into 0 error code.
+                */
+               device = btrfs_scan_one_device(vol->name, BLK_OPEN_READ, false);
+               if (IS_ERR_OR_NULL(device)) {
                        mutex_unlock(&uuid_mutex);
                        ret = PTR_ERR(device);
                        break;
@@ -2408,9 +2365,6 @@ static int __init btrfs_print_mod_info(void)
 #ifdef CONFIG_BTRFS_ASSERT
                        ", assert=on"
 #endif
-#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
-                       ", integrity-checker=on"
-#endif
 #ifdef CONFIG_BTRFS_FS_REF_VERIFY
                        ", ref-verify=on"
 #endif