bcachefs: Add a persistent counter for bucket invalidation

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet 2022-06-13 19:45:07 -04:00 committed by Kent Overstreet
parent 0e96f5dcd7
commit 440c15cc91
2 changed files with 11 additions and 5 deletions

View File

@ -1173,11 +1173,16 @@ static void bch2_do_invalidates_work(struct work_struct *work)
s64 nr_to_invalidate =
should_invalidate_buckets(ca, bch2_dev_usage_read(ca));
while (!ret && nr_to_invalidate-- >= 0)
while (nr_to_invalidate-- >= 0) {
ret = __bch2_trans_do(&trans, NULL, NULL,
BTREE_INSERT_USE_RESERVE|
BTREE_INSERT_NOFAIL,
invalidate_one_bucket(&trans, ca));
if (ret)
break;
this_cpu_inc(c->counters[BCH_COUNTER_bucket_invalidate]);
}
}
bch2_trans_exit(&trans);

View File

@ -1326,10 +1326,11 @@ struct bch_sb_field_disk_groups {
/* BCH_SB_FIELD_counters */
#define BCH_PERSISTENT_COUNTERS() \
x(io_read, 0) \
x(io_write, 1) \
x(io_move, 2)
#define BCH_PERSISTENT_COUNTERS() \
x(io_read, 0) \
x(io_write, 1) \
x(io_move, 2) \
x(bucket_invalidate, 3)
enum bch_persistent_counters {
#define x(t, n, ...) BCH_COUNTER_##t,