bcachefs: Add a persistent counter for bucket discards
authorKent Overstreet <kent.overstreet@gmail.com>
Tue, 14 Jun 2022 03:32:09 +0000 (23:32 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:33 +0000 (17:09 -0400)
Like the previous patch for bucket invalidates, add another counter for
a core allocator path.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/alloc_background.c
fs/bcachefs/bcachefs_format.h

index 543ec0c45883d7374db200c4d5b11b01672ca000..012607cefb6f60d4f8facc76867def364e01a6ba 100644 (file)
@@ -1052,6 +1052,7 @@ static void bch2_do_discards_work(struct work_struct *work)
                if (ret)
                        break;
 
+               this_cpu_inc(c->counters[BCH_COUNTER_bucket_discard]);
                discarded++;
        }
        bch2_trans_iter_exit(&trans, &iter);
index 944cc6247a842c7c076e1f44b7fb0cfe6dbd2205..b9d614f608b5b4c7d3f84287df2139ca9c9423d9 100644 (file)
@@ -1330,7 +1330,8 @@ struct bch_sb_field_disk_groups {
        x(io_read,              0)                      \
        x(io_write,             1)                      \
        x(io_move,              2)                      \
-       x(bucket_invalidate,    3)
+       x(bucket_invalidate,    3)                      \
+       x(bucket_discard,       4)
 
 enum bch_persistent_counters {
 #define x(t, n, ...) BCH_COUNTER_##t,