summaryrefslogtreecommitdiff
path: root/fs/bcachefs/sysfs.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2023-05-30 14:41:50 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:10:03 -0400
commitfec4fc82b531beb2cc67b734140ffe776af33f7c (patch)
tree69eb17cf9b842e4ae2071a30a9ccc8c1d9afb7b9 /fs/bcachefs/sysfs.c
parent28551613b725c28552210121499f4e2f6c6a9054 (diff)
bcachefs: create internal disk_groups sysfs file
We have bch2_sb_disk_groups_to_text() to dump disk group labels, but no good information on device group membership at runtime. Add bch2_disk_groups_to_text() and an associated 'disk_groups' sysfs file to print group and device relationships. Signed-off-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/sysfs.c')
-rw-r--r--fs/bcachefs/sysfs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c
index b2274cb35172..77f92d537af6 100644
--- a/fs/bcachefs/sysfs.c
+++ b/fs/bcachefs/sysfs.c
@@ -223,6 +223,7 @@ static void bch2_write_refs_to_text(struct printbuf *out, struct bch_fs *c)
#endif
read_attribute(internal_uuid);
+read_attribute(disk_groups);
read_attribute(has_data);
read_attribute(alloc_debug);
@@ -471,6 +472,9 @@ SHOW(bch2_fs)
if (attr == &sysfs_nocow_lock_table)
bch2_nocow_locks_to_text(out, &c->nocow_locks);
+ if (attr == &sysfs_disk_groups)
+ bch2_disk_groups_to_text(out, c);
+
return 0;
}
@@ -681,6 +685,8 @@ struct attribute *bch2_fs_internal_files[] = {
&sysfs_moving_ctxts,
&sysfs_internal_uuid,
+
+ &sysfs_disk_groups,
NULL
};