]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Btrfs: add mount option to force UUID tree checking
authorStefan Behrens <sbehrens@giantdisaster.de>
Thu, 15 Aug 2013 15:11:24 +0000 (17:11 +0200)
committerChris Mason <chris.mason@fusionio.com>
Sun, 1 Sep 2013 12:15:59 +0000 (08:15 -0400)
This should never be needed, but since all functions are there
to check and rebuild the UUID tree, a mount option is added that
allows to force this check and rebuild procedure.

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/super.c

index 8c954766db93301fac96880450ae046d5120c1c5..0ef9d866952fd74a7d760323941477cf67ea45be 100644 (file)
@@ -1998,6 +1998,7 @@ struct btrfs_ioctl_defrag_range_args {
 #define BTRFS_MOUNT_CHECK_INTEGRITY    (1 << 20)
 #define BTRFS_MOUNT_CHECK_INTEGRITY_INCLUDING_EXTENT_DATA (1 << 21)
 #define BTRFS_MOUNT_PANIC_ON_FATAL_ERROR       (1 << 22)
+#define BTRFS_MOUNT_RESCAN_UUID_TREE   (1 << 23)
 
 #define BTRFS_DEFAULT_COMMIT_INTERVAL  (30)
 
index e7ef82ad0d2626afddf9f917753a5c2b46a18ac8..00914a62abecf05d74e048e3402670bb180eb9b8 100644 (file)
@@ -2929,7 +2929,8 @@ retry_root_backup:
                        close_ctree(tree_root);
                        return ret;
                }
-       } else if (check_uuid_tree) {
+       } else if (check_uuid_tree ||
+                  btrfs_test_opt(tree_root, RESCAN_UUID_TREE)) {
                pr_info("btrfs: checking UUID tree\n");
                ret = btrfs_check_uuid_tree(fs_info);
                if (ret) {
index 1bd0bb5236603e77c6b2ad53b9aab7240b064acd..57090b4284fe78097a5a57c1c8adf30dfa76797f 100644 (file)
@@ -321,7 +321,7 @@ enum {
        Opt_enospc_debug, Opt_subvolrootid, Opt_defrag, Opt_inode_cache,
        Opt_no_space_cache, Opt_recovery, Opt_skip_balance,
        Opt_check_integrity, Opt_check_integrity_including_extent_data,
-       Opt_check_integrity_print_mask, Opt_fatal_errors,
+       Opt_check_integrity_print_mask, Opt_fatal_errors, Opt_rescan_uuid_tree,
        Opt_commit_interval,
        Opt_err,
 };
@@ -362,6 +362,7 @@ static match_table_t tokens = {
        {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_rescan_uuid_tree, "rescan_uuid_tree"},
        {Opt_fatal_errors, "fatal_errors=%s"},
        {Opt_commit_interval, "commit=%d"},
        {Opt_err, NULL},
@@ -572,6 +573,9 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
                case Opt_space_cache:
                        btrfs_set_opt(info->mount_opt, SPACE_CACHE);
                        break;
+               case Opt_rescan_uuid_tree:
+                       btrfs_set_opt(info->mount_opt, RESCAN_UUID_TREE);
+                       break;
                case Opt_no_space_cache:
                        printk(KERN_INFO "btrfs: disabling disk space caching\n");
                        btrfs_clear_opt(info->mount_opt, SPACE_CACHE);
@@ -979,6 +983,8 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
                seq_puts(seq, ",space_cache");
        else
                seq_puts(seq, ",nospace_cache");
+       if (btrfs_test_opt(root, RESCAN_UUID_TREE))
+               seq_puts(seq, ",rescan_uuid_tree");
        if (btrfs_test_opt(root, CLEAR_CACHE))
                seq_puts(seq, ",clear_cache");
        if (btrfs_test_opt(root, USER_SUBVOL_RM_ALLOWED))