Commit cba7c35f authored by Leo Martins's avatar Leo Martins Committed by David Sterba
Browse files

btrfs: move ref-verify under CONFIG_BTRFS_DEBUG



Remove CONFIG_BTRFS_FS_REF_VERIFY Kconfig and add it as part of
CONFIG_BTRFS_DEBUG. This should not be impactful to the performance
of debug. The struct btrfs_ref takes an additional u64, btrfs_fs_info
takes an additional spinlock_t and rb_root. All of the ref_verify logic
is still protected by a mount option.

Signed-off-by: default avatarLeo Martins <loemra.dev@gmail.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 28a38e20
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -117,14 +117,3 @@ config BTRFS_EXPERIMENTAL
	  - large folio support

	  If unsure, say N.

config BTRFS_FS_REF_VERIFY
	bool "Btrfs with the ref verify tool compiled in"
	depends on BTRFS_FS
	default n
	help
	  Enable run-time extent reference verification instrumentation.  This
	  is meant to be used by btrfs developers for tracking down extent
	  reference problems or verifying they didn't break something.

	  If unsure, say N.
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ btrfs-y += super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \
	   lru_cache.o raid-stripe-tree.o fiemap.o direct-io.o

btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o
btrfs-$(CONFIG_BTRFS_FS_REF_VERIFY) += ref-verify.o
btrfs-$(CONFIG_BTRFS_DEBUG) += ref-verify.o
btrfs-$(CONFIG_BLK_DEV_ZONED) += zoned.o
btrfs-$(CONFIG_FS_VERITY) += verity.o

+2 −2
Original line number Diff line number Diff line
@@ -952,7 +952,7 @@ static void init_delayed_ref_common(struct btrfs_fs_info *fs_info,
void btrfs_init_tree_ref(struct btrfs_ref *generic_ref, int level, u64 mod_root,
			 bool skip_qgroup)
{
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
#ifdef CONFIG_BTRFS_DEBUG
	/* If @real_root not set, use @root as fallback */
	generic_ref->real_root = mod_root ?: generic_ref->ref_root;
#endif
@@ -969,7 +969,7 @@ void btrfs_init_tree_ref(struct btrfs_ref *generic_ref, int level, u64 mod_root,
void btrfs_init_data_ref(struct btrfs_ref *generic_ref, u64 ino, u64 offset,
			 u64 mod_root, bool skip_qgroup)
{
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
#ifdef CONFIG_BTRFS_DEBUG
	/* If @real_root not set, use @root as fallback */
	generic_ref->real_root = mod_root ?: generic_ref->ref_root;
#endif
+5 −4
Original line number Diff line number Diff line
@@ -276,10 +276,6 @@ struct btrfs_ref {
	 */
	bool skip_qgroup;

#ifdef CONFIG_BTRFS_FS_REF_VERIFY
	/* Through which root is this modification. */
	u64 real_root;
#endif
	u64 bytenr;
	u64 num_bytes;
	u64 owning_root;
@@ -296,6 +292,11 @@ struct btrfs_ref {
		struct btrfs_data_ref data_ref;
		struct btrfs_tree_ref tree_ref;
	};

#ifdef CONFIG_BTRFS_DEBUG
	/* Through which root is this modification. */
	u64 real_root;
#endif
};

extern struct kmem_cache *btrfs_delayed_ref_head_cachep;
+1 −3
Original line number Diff line number Diff line
@@ -880,12 +880,10 @@ struct btrfs_fs_info {
	struct lockdep_map btrfs_trans_pending_ordered_map;
	struct lockdep_map btrfs_ordered_extent_map;

#ifdef CONFIG_BTRFS_FS_REF_VERIFY
#ifdef CONFIG_BTRFS_DEBUG
	spinlock_t ref_verify_lock;
	struct rb_root block_tree;
#endif

#ifdef CONFIG_BTRFS_DEBUG
	struct kobject *debug_kobj;
	struct list_head allocated_roots;

Loading