summaryrefslogtreecommitdiff
path: root/fs/bcachefs/sysfs.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-06-13 19:34:17 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:33 -0400
commit0e96f5dcd7ff678c5448f64cb957117399754d2e (patch)
tree5495d03dacf148994cc1be7722e8e7881808299c /fs/bcachefs/sysfs.c
parenta5d18f9ec0e2cfce1e0dc50f07d614ba21edaae9 (diff)
bcachefs: Call bch2_do_invalidates() when going read write
Like bch2_do_discards(), we should check if this needs to be done when going rw. Also, add some sysfs code for debugging bucket invalidation. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/sysfs.c')
-rw-r--r--fs/bcachefs/sysfs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c
index 4a85fffdfa4c..b2d6a5c49a4d 100644
--- a/fs/bcachefs/sysfs.c
+++ b/fs/bcachefs/sysfs.c
@@ -154,6 +154,7 @@ do { \
write_attribute(trigger_gc);
write_attribute(trigger_discards);
+write_attribute(trigger_invalidates);
write_attribute(prune_cache);
rw_attribute(btree_gc_periodic);
rw_attribute(gc_gens_pos);
@@ -516,6 +517,9 @@ STORE(bch2_fs)
if (attr == &sysfs_trigger_discards)
bch2_do_discards(c);
+ if (attr == &sysfs_trigger_invalidates)
+ bch2_do_invalidates(c);
+
#ifdef CONFIG_BCACHEFS_TESTS
if (attr == &sysfs_perf_test) {
char *tmp = kstrdup(buf, GFP_KERNEL), *p = tmp;
@@ -627,6 +631,7 @@ struct attribute *bch2_fs_internal_files[] = {
&sysfs_trigger_gc,
&sysfs_trigger_discards,
+ &sysfs_trigger_invalidates,
&sysfs_prune_cache,
&sysfs_read_realloc_races,
@@ -792,6 +797,7 @@ static void dev_alloc_debug_to_text(struct printbuf *out, struct bch_dev *ca)
"open_buckets_wait\t%s\n"
"open_buckets_btree\t%u\n"
"open_buckets_user\t%u\n"
+ "buckets_to_invalidate\t%llu\n"
"btree reserve cache\t%u\n",
stats.buckets_ec,
c->freelist_wait.list.first ? "waiting" : "empty",
@@ -801,6 +807,7 @@ static void dev_alloc_debug_to_text(struct printbuf *out, struct bch_dev *ca)
c->open_buckets_wait.list.first ? "waiting" : "empty",
nr[BCH_DATA_btree],
nr[BCH_DATA_user],
+ should_invalidate_buckets(ca, stats),
c->btree_reserve_cache_nr);
}