summaryrefslogtreecommitdiff
path: root/fs/bcachefs/sysfs.c
diff options
context:
space:
mode:
authorDaniel Hill <daniel@gluo.nz>2022-12-07 18:41:21 +1300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:51 -0400
commit71fe14655f49f717b06d92192f2492c22da6b3af (patch)
tree33bcbc91f251492ab90ea27266938af9777691e4 /fs/bcachefs/sysfs.c
parent5250b74d55e16246a47bdcf1182b7469e28e0652 (diff)
bcachefs: expose nocow_lock table in sysfs
Signed-off-by: Daniel Hill <daniel@gluo.nz> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/sysfs.c')
-rw-r--r--fs/bcachefs/sysfs.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c
index 20484f67c3bc..5b1f792243cd 100644
--- a/fs/bcachefs/sysfs.c
+++ b/fs/bcachefs/sysfs.c
@@ -194,6 +194,7 @@ read_attribute(btree_key_cache);
read_attribute(stripes_heap);
read_attribute(open_buckets);
read_attribute(write_points);
+read_attribute(nocow_lock_table);
#ifdef BCH_WRITE_REF_DEBUG
read_attribute(write_refs);
@@ -476,6 +477,23 @@ SHOW(bch2_fs)
bch2_write_refs_to_text(out, c);
#endif
+ if (attr == &sysfs_nocow_lock_table) {
+ int i, count = 1;
+ long last, curr = 0;
+
+ last = atomic_long_read(&c->nocow_locks.l[0].v);
+ for (i = 1; i < BUCKET_NOCOW_LOCKS; i++) {
+ curr = atomic_long_read(&c->nocow_locks.l[i].v);
+ if (last != curr) {
+ prt_printf(out, "%li: %d\n", last, count);
+ count = 1;
+ last = curr;
+ } else
+ count++;
+ }
+ prt_printf(out, "%li: %d\n", last, count);
+ }
+
return 0;
}
@@ -662,6 +680,7 @@ struct attribute *bch2_fs_internal_files[] = {
#ifdef BCH_WRITE_REF_DEBUG
&sysfs_write_refs,
#endif
+ &sysfs_nocow_lock_table,
&sysfs_io_timers_read,
&sysfs_io_timers_write,