Commit 0e96f5dc authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

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: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent a5d18f9e
......@@ -383,6 +383,7 @@ static int __bch2_fs_read_write(struct bch_fs *c, bool early)
bch2_recalc_capacity(c);
bch2_do_discards(c);
bch2_do_invalidates(c);
if (!early) {
ret = bch2_fs_read_write_late(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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment