This adds the infrastructure for turning ref verify on and off for a
mount, to be used by a later patch.

Signed-off-by: Josef Bacik <jba...@fb.com>
---
 fs/btrfs/ctree.h |  1 +
 fs/btrfs/super.c | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 93e767e16a43..f1bd12f5f2d5 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1334,6 +1334,7 @@ static inline u32 BTRFS_MAX_XATTR_SIZE(const struct 
btrfs_fs_info *info)
 #define BTRFS_MOUNT_FRAGMENT_METADATA  (1 << 25)
 #define BTRFS_MOUNT_FREE_SPACE_TREE    (1 << 26)
 #define BTRFS_MOUNT_NOLOGREPLAY                (1 << 27)
+#define BTRFS_MOUNT_REF_VERIFY         (1 << 28)
 
 #define BTRFS_DEFAULT_COMMIT_INTERVAL  (30)
 #define BTRFS_DEFAULT_MAX_INLINE       (2048)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index f88ac4ebe01a..8e74f7029e12 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -326,6 +326,9 @@ enum {
 #ifdef CONFIG_BTRFS_DEBUG
        Opt_fragment_data, Opt_fragment_metadata, Opt_fragment_all,
 #endif
+#ifdef CONFIG_BTRFS_FS_REF_VERIFY
+       Opt_ref_verify,
+#endif
        Opt_err,
 };
 
@@ -387,6 +390,9 @@ static const match_table_t tokens = {
        {Opt_fragment_metadata, "fragment=metadata"},
        {Opt_fragment_all, "fragment=all"},
 #endif
+#ifdef CONFIG_BTRFS_FS_REF_VERIFY
+       {Opt_ref_verify, "ref_verify"},
+#endif
        {Opt_err, NULL},
 };
 
@@ -827,6 +833,13 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char 
*options,
                        btrfs_set_opt(info->mount_opt, FRAGMENT_DATA);
                        break;
 #endif
+#ifdef CONFIG_BTRFS_FS_REF_VERIFY
+               case Opt_ref_verify:
+                       btrfs_info(info, "doing ref verification");
+                       btrfs_set_opt(info->mount_opt,
+                                     REF_VERIFY);
+                       break;
+#endif
                case Opt_err:
                        btrfs_info(info, "unrecognized mount option '%s'", p);
                        ret = -EINVAL;
@@ -1309,6 +1322,8 @@ static int btrfs_show_options(struct seq_file *seq, 
struct dentry *dentry)
        if (btrfs_test_opt(info, FRAGMENT_METADATA))
                seq_puts(seq, ",fragment=metadata");
 #endif
+       if (btrfs_test_opt(info, REF_VERIFY))
+               seq_puts(seq, ",ref_verify");
        seq_printf(seq, ",subvolid=%llu",
                  BTRFS_I(d_inode(dentry))->root->root_key.objectid);
        seq_puts(seq, ",subvol=");
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to