Skip to contentSkip to conversation

btrfs: remove ref-verify kconfig

PATCH In review Leo Martins 2 participants 3 messages Aug 12, 2025 – Aug 13, 2025 Btrfs file system

lore
Share & tools
lore
#0 lore raw

cover btrfs: remove ref-verify kconfig

Requested by David Sterba to unify debug things under CONFIG_BTRFS_DEBUG Kconfig. This touches similar code to my ref_tracker patch linked below, if it's easier I can send out a new patch set with this patch on top of my ref_tracker patches to resolve any merge conflicts.

Leo Martins (1):
btrfs: remove ref-verify kconfig

 fs/btrfs/Kconfig       | 11 -----------
 fs/btrfs/Makefile      |  2 +-
 fs/btrfs/delayed-ref.c |  2 +-
 fs/btrfs/delayed-ref.h |  2 +-
 fs/btrfs/fs.h          |  4 +---
 fs/btrfs/ref-verify.h  |  4 ++--
 fs/btrfs/super.c       | 10 +---------
 7 files changed, 7 insertions(+), 28 deletions(-)
Signature · 1 line
2.47.3
#1 lore raw

PATCH 1/1 btrfs: remove ref-verify kconfig

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. 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.

---
 fs/btrfs/Kconfig       | 11 -----------
 fs/btrfs/Makefile      |  2 +-
 fs/btrfs/delayed-ref.c |  2 +-
 fs/btrfs/delayed-ref.h |  2 +-
 fs/btrfs/fs.h          |  4 +---
 fs/btrfs/ref-verify.h  |  4 ++--
 fs/btrfs/super.c       | 10 +---------
 7 files changed, 7 insertions(+), 28 deletions(-)
fs/btrfs/Kconfig +0 -11
index ea95c90c84748..86d791210c393 100644
@@ -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.
fs/btrfs/Makefile +1 -1
index 2d5f0482678b8..743d7677b175d 100644
@@ -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
 
fs/btrfs/delayed-ref.c +1 -1
index ca382c5b186f4..7b357a4b3ce3d 100644
@@ -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
fs/btrfs/delayed-ref.h +1 -1
index 552ec4fa645d4..448c248f70dc0 100644
@@ -276,7 +276,7 @@ struct btrfs_ref {
 	 */
 	bool skip_qgroup;
 
-#ifdef CONFIG_BTRFS_FS_REF_VERIFY
+#ifdef CONFIG_BTRFS_DEBUG
 	/* Through which root is this modification. */
 	u64 real_root;
 #endif
fs/btrfs/fs.h +1 -3
index f0b090d4ac046..66e08e20ff5ac 100644
@@ -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;
 
fs/btrfs/ref-verify.h +2 -2
index 559bd25a2b7ab..1ce544d53cc56 100644
@@ -12,7 +12,7 @@
 struct btrfs_fs_info;
 struct btrfs_ref;
 
-#ifdef CONFIG_BTRFS_FS_REF_VERIFY
+#ifdef CONFIG_BTRFS_DEBUG
 
 #include <linux/spinlock.h>
 
@@ -53,6 +53,6 @@ static inline void btrfs_init_ref_verify(struct btrfs_fs_info *fs_info)
 {
 }
 
-#endif /* CONFIG_BTRFS_FS_REF_VERIFY */
+#endif /* CONFIG_BTRFS_DEBUG */
 
 #endif
fs/btrfs/super.c +1 -9
index 831d9cd01244d..f6b61207979a4 100644
@@ -130,8 +130,6 @@ enum {
 	Opt_enospc_debug,
 #ifdef CONFIG_BTRFS_DEBUG
 	Opt_fragment, Opt_fragment_data, Opt_fragment_metadata, Opt_fragment_all,
-#endif
-#ifdef CONFIG_BTRFS_FS_REF_VERIFY
 	Opt_ref_verify,
 #endif
 	Opt_err,
@@ -254,8 +252,6 @@ static const struct fs_parameter_spec btrfs_fs_parameters[] = {
 	fsparam_flag_no("enospc_debug", Opt_enospc_debug),
 #ifdef CONFIG_BTRFS_DEBUG
 	fsparam_enum("fragment", Opt_fragment, btrfs_parameter_fragment),
-#endif
-#ifdef CONFIG_BTRFS_FS_REF_VERIFY
 	fsparam_flag("ref_verify", Opt_ref_verify),
 #endif
 	{}
@@ -629,8 +625,6 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
 			return -EINVAL;
 		}
 		break;
-#endif
-#ifdef CONFIG_BTRFS_FS_REF_VERIFY
 	case Opt_ref_verify:
 		btrfs_set_opt(ctx->mount_opt, REF_VERIFY);
 		break;
@@ -2462,13 +2456,11 @@ static int __init btrfs_print_mod_info(void)
 #endif
 #ifdef CONFIG_BTRFS_DEBUG
 			", debug=on"
+			", ref-verify=on"
 #endif
 #ifdef CONFIG_BTRFS_ASSERT
 			", assert=on"
 #endif
-#ifdef CONFIG_BTRFS_FS_REF_VERIFY
-			", ref-verify=on"
-#endif
 #ifdef CONFIG_BLK_DEV_ZONED
 			", zoned=yes"
 #else
Signature · 1 line
2.47.3
#2 lore raw
In reply to Leo Martins
Quoted 5 lines · Leo Martins

Requested by David Sterba to unify debug things under CONFIG_BTRFS_DEBUG Kconfig. This touches similar code to my ref_tracker patch linked below, if it's easier I can send out a new patch set with this patch on top of my ref_tracker patches to resolve any merge conflicts.

I think it's better to take this patch first, the ref tracker might have some changes. Added to for-next, thanks.