summaryrefslogtreecommitdiff
path: root/fs/bcachefs/sysfs.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-04-13 15:00:40 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:00 -0400
commitac516d0e7db76bc77dea9313570b3924e0605d7b (patch)
tree94f80123d1d9a2b5d85c800001ff5c3a461f7f71 /fs/bcachefs/sysfs.c
parent319c1305071c3ac813c3ea9eed15d1a0d26f983a (diff)
bcachefs: Add the status of bucket gen gc to sysfs
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/sysfs.c')
-rw-r--r--fs/bcachefs/sysfs.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c
index dd9b54e0d80b..077f3a8cead7 100644
--- a/fs/bcachefs/sysfs.c
+++ b/fs/bcachefs/sysfs.c
@@ -136,6 +136,7 @@ write_attribute(trigger_btree_coalesce);
write_attribute(trigger_gc);
write_attribute(prune_cache);
rw_attribute(btree_gc_periodic);
+rw_attribute(gc_gens_pos);
read_attribute(uuid);
read_attribute(minor);
@@ -312,6 +313,13 @@ static int bch2_compression_stats_to_text(struct printbuf *out, struct bch_fs *c
return 0;
}
+void bch2_gc_gens_pos_to_text(struct printbuf *out, struct bch_fs *c)
+{
+ pr_buf(out, "%s: ", bch2_btree_ids[c->gc_gens_btree]);
+ bch2_bpos_to_text(out, c->gc_gens_pos);
+ pr_buf(out, "\n");
+}
+
SHOW(bch2_fs)
{
struct bch_fs *c = container_of(kobj, struct bch_fs, kobj);
@@ -337,6 +345,11 @@ SHOW(bch2_fs)
sysfs_printf(btree_gc_periodic, "%u", (int) c->btree_gc_periodic);
+ if (attr == &sysfs_gc_gens_pos) {
+ bch2_gc_gens_pos_to_text(&out, c);
+ return out.pos - buf;
+ }
+
sysfs_printf(copy_gc_enabled, "%i", c->copy_gc_enabled);
sysfs_printf(rebalance_enabled, "%i", c->rebalance.enabled);
@@ -566,6 +579,7 @@ struct attribute *bch2_fs_internal_files[] = {
&sysfs_trigger_journal_flush,
&sysfs_trigger_btree_coalesce,
&sysfs_trigger_gc,
+ &sysfs_gc_gens_pos,
&sysfs_prune_cache,
&sysfs_copy_gc_enabled,