summaryrefslogtreecommitdiff
path: root/fs/bcachefs/sysfs.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-04-07 18:38:16 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-04-17 15:44:30 -0400
commit0f1748d6aaabbe6bf0b5f801cc17d387bc69529e (patch)
treef62f474e68ccd6298599ba737009433879c88ccf /fs/bcachefs/sysfs.c
parent442c25b43280de27a2a0cbc36b366b6f87ab1de5 (diff)
bcachefs: Add a sysfs attr for triggering discards
We're currently debugging an issue with discards not getting run; this patch adds a manual trigger so we can then watch the tracepoint while it runs. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/sysfs.c')
-rw-r--r--fs/bcachefs/sysfs.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c
index ff34578f9124..fb5e930e86d8 100644
--- a/fs/bcachefs/sysfs.c
+++ b/fs/bcachefs/sysfs.c
@@ -150,6 +150,7 @@ do { \
} while (0)
write_attribute(trigger_gc);
+write_attribute(trigger_discards);
write_attribute(prune_cache);
rw_attribute(btree_gc_periodic);
rw_attribute(gc_gens_pos);
@@ -501,6 +502,9 @@ STORE(bch2_fs)
#endif
}
+ if (attr == &sysfs_trigger_discards)
+ bch2_do_discards(c);
+
#ifdef CONFIG_BCACHEFS_TESTS
if (attr == &sysfs_perf_test) {
char *tmp = kstrdup(buf, GFP_KERNEL), *p = tmp;
@@ -568,6 +572,7 @@ struct attribute *bch2_fs_internal_files[] = {
&sysfs_io_timers_write,
&sysfs_trigger_gc,
+ &sysfs_trigger_discards,
&sysfs_prune_cache,
&sysfs_read_realloc_races,