* [PATCH] bcachefs: create debugfs dir for each btree
@ 2024-03-14 16:02 Thomas Bertschinger
2024-03-15 0:05 ` Kent Overstreet
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Bertschinger @ 2024-03-14 16:02 UTC (permalink / raw)
To: kent.overstreet, linux-bcachefs, bfoster; +Cc: Thomas Bertschinger
This creates a subdirectory for each individual btree under the btrees/
debugfs directory.
Directory structure, before:
/sys/kernel/debug/bcachefs/$FS_ID/btrees/
├── alloc
├── alloc-bfloat-failed
├── alloc-formats
├── backpointers
├── backpointers-bfloat-failed
├── backpointers-formats
...
Directory structure, after:
/sys/kernel/debug/bcachefs/$FS_ID/btrees/
├── alloc
│ ├── bfloat-failed
│ ├── formats
│ └── nodes
├── backpointers
│ ├── bfloat-failed
│ ├── formats
│ └── nodes
...
Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
---
fs/bcachefs/debug.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/fs/bcachefs/debug.c b/fs/bcachefs/debug.c
index b1f147e6be4d..491ad699d558 100644
--- a/fs/bcachefs/debug.c
+++ b/fs/bcachefs/debug.c
@@ -866,6 +866,20 @@ void bch2_fs_debug_exit(struct bch_fs *c)
debugfs_remove_recursive(c->fs_debug_dir);
}
+static void bch2_fs_debug_btree_init(struct bch_fs *c, struct btree_debug *bd)
+{
+ struct dentry *d;
+
+ d = debugfs_create_dir(bch2_btree_id_str(bd->id), c->btree_debug_dir);
+
+ debugfs_create_file("nodes", 0400, d, bd, &btree_debug_ops);
+
+ debugfs_create_file("formats", 0400, d, bd, &btree_format_debug_ops);
+
+ debugfs_create_file("bfloat-failed", 0400, d, bd,
+ &bfloat_failed_debug_ops);
+}
+
void bch2_fs_debug_init(struct bch_fs *c)
{
struct btree_debug *bd;
@@ -902,21 +916,7 @@ void bch2_fs_debug_init(struct bch_fs *c)
bd < c->btree_debug + ARRAY_SIZE(c->btree_debug);
bd++) {
bd->id = bd - c->btree_debug;
- debugfs_create_file(bch2_btree_id_str(bd->id),
- 0400, c->btree_debug_dir, bd,
- &btree_debug_ops);
-
- snprintf(name, sizeof(name), "%s-formats",
- bch2_btree_id_str(bd->id));
-
- debugfs_create_file(name, 0400, c->btree_debug_dir, bd,
- &btree_format_debug_ops);
-
- snprintf(name, sizeof(name), "%s-bfloat-failed",
- bch2_btree_id_str(bd->id));
-
- debugfs_create_file(name, 0400, c->btree_debug_dir, bd,
- &bfloat_failed_debug_ops);
+ bch2_fs_debug_btree_init(c, bd);
}
}
--
2.43.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] bcachefs: create debugfs dir for each btree
2024-03-14 16:02 [PATCH] bcachefs: create debugfs dir for each btree Thomas Bertschinger
@ 2024-03-15 0:05 ` Kent Overstreet
2024-03-15 1:29 ` Thomas Bertschinger
0 siblings, 1 reply; 4+ messages in thread
From: Kent Overstreet @ 2024-03-15 0:05 UTC (permalink / raw)
To: Thomas Bertschinger; +Cc: linux-bcachefs, bfoster
On Thu, Mar 14, 2024 at 10:02:18AM -0600, Thomas Bertschinger wrote:
> This creates a subdirectory for each individual btree under the btrees/
> debugfs directory.
>
> Directory structure, before:
>
> /sys/kernel/debug/bcachefs/$FS_ID/btrees/
> ├── alloc
> ├── alloc-bfloat-failed
> ├── alloc-formats
> ├── backpointers
> ├── backpointers-bfloat-failed
> ├── backpointers-formats
> ...
>
> Directory structure, after:
>
> /sys/kernel/debug/bcachefs/$FS_ID/btrees/
> ├── alloc
> │ ├── bfloat-failed
> │ ├── formats
> │ └── nodes
> ├── backpointers
> │ ├── bfloat-failed
> │ ├── formats
> │ └── nodes
nodes should actually be keys - nodes would be showing the node
structure, only cmd_list.rs currently does that (but -formats covers it)
> ...
>
> Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
> ---
> fs/bcachefs/debug.c | 30 +++++++++++++++---------------
> 1 file changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/fs/bcachefs/debug.c b/fs/bcachefs/debug.c
> index b1f147e6be4d..491ad699d558 100644
> --- a/fs/bcachefs/debug.c
> +++ b/fs/bcachefs/debug.c
> @@ -866,6 +866,20 @@ void bch2_fs_debug_exit(struct bch_fs *c)
> debugfs_remove_recursive(c->fs_debug_dir);
> }
>
> +static void bch2_fs_debug_btree_init(struct bch_fs *c, struct btree_debug *bd)
> +{
> + struct dentry *d;
> +
> + d = debugfs_create_dir(bch2_btree_id_str(bd->id), c->btree_debug_dir);
> +
> + debugfs_create_file("nodes", 0400, d, bd, &btree_debug_ops);
> +
> + debugfs_create_file("formats", 0400, d, bd, &btree_format_debug_ops);
> +
> + debugfs_create_file("bfloat-failed", 0400, d, bd,
> + &bfloat_failed_debug_ops);
> +}
> +
> void bch2_fs_debug_init(struct bch_fs *c)
> {
> struct btree_debug *bd;
> @@ -902,21 +916,7 @@ void bch2_fs_debug_init(struct bch_fs *c)
> bd < c->btree_debug + ARRAY_SIZE(c->btree_debug);
> bd++) {
> bd->id = bd - c->btree_debug;
> - debugfs_create_file(bch2_btree_id_str(bd->id),
> - 0400, c->btree_debug_dir, bd,
> - &btree_debug_ops);
> -
> - snprintf(name, sizeof(name), "%s-formats",
> - bch2_btree_id_str(bd->id));
> -
> - debugfs_create_file(name, 0400, c->btree_debug_dir, bd,
> - &btree_format_debug_ops);
> -
> - snprintf(name, sizeof(name), "%s-bfloat-failed",
> - bch2_btree_id_str(bd->id));
> -
> - debugfs_create_file(name, 0400, c->btree_debug_dir, bd,
> - &bfloat_failed_debug_ops);
> + bch2_fs_debug_btree_init(c, bd);
> }
> }
>
> --
> 2.43.2
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] bcachefs: create debugfs dir for each btree
2024-03-15 0:05 ` Kent Overstreet
@ 2024-03-15 1:29 ` Thomas Bertschinger
2024-03-15 1:45 ` Kent Overstreet
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Bertschinger @ 2024-03-15 1:29 UTC (permalink / raw)
To: Kent Overstreet; +Cc: linux-bcachefs, bfoster
On Thu, Mar 14, 2024 at 08:05:57PM -0400, Kent Overstreet wrote:
> nodes should actually be keys - nodes would be showing the node
> structure, only cmd_list.rs currently does that (but -formats covers it)
>
Ah, yup. Should I send a v2, or is that a small enough fix that you can
just amend it?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] bcachefs: create debugfs dir for each btree
2024-03-15 1:29 ` Thomas Bertschinger
@ 2024-03-15 1:45 ` Kent Overstreet
0 siblings, 0 replies; 4+ messages in thread
From: Kent Overstreet @ 2024-03-15 1:45 UTC (permalink / raw)
To: Thomas Bertschinger; +Cc: linux-bcachefs, bfoster
On Thu, Mar 14, 2024 at 07:29:55PM -0600, Thomas Bertschinger wrote:
> On Thu, Mar 14, 2024 at 08:05:57PM -0400, Kent Overstreet wrote:
> > nodes should actually be keys - nodes would be showing the node
> > structure, only cmd_list.rs currently does that (but -formats covers it)
> >
>
> Ah, yup. Should I send a v2, or is that a small enough fix that you can
> just amend it?
yeah I can do it
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-03-15 1:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-14 16:02 [PATCH] bcachefs: create debugfs dir for each btree Thomas Bertschinger
2024-03-15 0:05 ` Kent Overstreet
2024-03-15 1:29 ` Thomas Bertschinger
2024-03-15 1:45 ` Kent Overstreet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox