Skip to content

Commit 7a319ef

Browse files
loemrawkdave
authored andcommitted
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: Leo Martins <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent db993f4 commit 7a319ef

File tree

7 files changed

+11
-31
lines changed

7 files changed

+11
-31
lines changed

fs/btrfs/Kconfig

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,3 @@ config BTRFS_EXPERIMENTAL
117117
- large folio support
118118

119119
If unsure, say N.
120-
121-
config BTRFS_FS_REF_VERIFY
122-
bool "Btrfs with the ref verify tool compiled in"
123-
depends on BTRFS_FS
124-
default n
125-
help
126-
Enable run-time extent reference verification instrumentation. This
127-
is meant to be used by btrfs developers for tracking down extent
128-
reference problems or verifying they didn't break something.
129-
130-
If unsure, say N.

fs/btrfs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ btrfs-y += super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \
3636
lru_cache.o raid-stripe-tree.o fiemap.o direct-io.o
3737

3838
btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o
39-
btrfs-$(CONFIG_BTRFS_FS_REF_VERIFY) += ref-verify.o
39+
btrfs-$(CONFIG_BTRFS_DEBUG) += ref-verify.o
4040
btrfs-$(CONFIG_BLK_DEV_ZONED) += zoned.o
4141
btrfs-$(CONFIG_FS_VERITY) += verity.o
4242

fs/btrfs/delayed-ref.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ static void init_delayed_ref_common(struct btrfs_fs_info *fs_info,
952952
void btrfs_init_tree_ref(struct btrfs_ref *generic_ref, int level, u64 mod_root,
953953
bool skip_qgroup)
954954
{
955-
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
955+
#ifdef CONFIG_BTRFS_DEBUG
956956
/* If @real_root not set, use @root as fallback */
957957
generic_ref->real_root = mod_root ?: generic_ref->ref_root;
958958
#endif

fs/btrfs/delayed-ref.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,6 @@ struct btrfs_ref {
276276
*/
277277
bool skip_qgroup;
278278

279-
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
280-
/* Through which root is this modification. */
281-
u64 real_root;
282-
#endif
283279
u64 bytenr;
284280
u64 num_bytes;
285281
u64 owning_root;
@@ -296,6 +292,11 @@ struct btrfs_ref {
296292
struct btrfs_data_ref data_ref;
297293
struct btrfs_tree_ref tree_ref;
298294
};
295+
296+
#ifdef CONFIG_BTRFS_DEBUG
297+
/* Through which root is this modification. */
298+
u64 real_root;
299+
#endif
299300
};
300301

301302
extern struct kmem_cache *btrfs_delayed_ref_head_cachep;

fs/btrfs/fs.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -880,12 +880,10 @@ struct btrfs_fs_info {
880880
struct lockdep_map btrfs_trans_pending_ordered_map;
881881
struct lockdep_map btrfs_ordered_extent_map;
882882

883-
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
883+
#ifdef CONFIG_BTRFS_DEBUG
884884
spinlock_t ref_verify_lock;
885885
struct rb_root block_tree;
886-
#endif
887886

888-
#ifdef CONFIG_BTRFS_DEBUG
889887
struct kobject *debug_kobj;
890888
struct list_head allocated_roots;
891889

fs/btrfs/ref-verify.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
struct btrfs_fs_info;
1313
struct btrfs_ref;
1414

15-
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
15+
#ifdef CONFIG_BTRFS_DEBUG
1616

1717
#include <linux/spinlock.h>
1818

@@ -53,6 +53,6 @@ static inline void btrfs_init_ref_verify(struct btrfs_fs_info *fs_info)
5353
{
5454
}
5555

56-
#endif /* CONFIG_BTRFS_FS_REF_VERIFY */
56+
#endif /* CONFIG_BTRFS_DEBUG */
5757

5858
#endif

fs/btrfs/super.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ enum {
133133
Opt_enospc_debug,
134134
#ifdef CONFIG_BTRFS_DEBUG
135135
Opt_fragment, Opt_fragment_data, Opt_fragment_metadata, Opt_fragment_all,
136-
#endif
137-
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
138136
Opt_ref_verify,
139137
#endif
140138
Opt_err,
@@ -257,8 +255,6 @@ static const struct fs_parameter_spec btrfs_fs_parameters[] = {
257255
fsparam_flag_no("enospc_debug", Opt_enospc_debug),
258256
#ifdef CONFIG_BTRFS_DEBUG
259257
fsparam_enum("fragment", Opt_fragment, btrfs_parameter_fragment),
260-
#endif
261-
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
262258
fsparam_flag("ref_verify", Opt_ref_verify),
263259
#endif
264260
{}
@@ -632,8 +628,6 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
632628
return -EINVAL;
633629
}
634630
break;
635-
#endif
636-
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
637631
case Opt_ref_verify:
638632
btrfs_set_opt(ctx->mount_opt, REF_VERIFY);
639633
break;
@@ -2465,13 +2459,11 @@ static int __init btrfs_print_mod_info(void)
24652459
#endif
24662460
#ifdef CONFIG_BTRFS_DEBUG
24672461
", debug=on"
2462+
", ref-verify=on"
24682463
#endif
24692464
#ifdef CONFIG_BTRFS_ASSERT
24702465
", assert=on"
24712466
#endif
2472-
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
2473-
", ref-verify=on"
2474-
#endif
24752467
#ifdef CONFIG_BLK_DEV_ZONED
24762468
", zoned=yes"
24772469
#else

0 commit comments

Comments
 (0)