bcachefs: add counter_flags for counters
authorHongbo Li <lihongbo22@huawei.com>
Tue, 12 Nov 2024 08:15:47 +0000 (16:15 +0800)
committerKent Overstreet <kent.overstreet@linux.dev>
Fri, 10 Jan 2025 04:38:41 +0000 (23:38 -0500)
commitd01ea14da718f7c30520c8498a7ba952b099ad83
tree90428b5f0e59d349f9a4ad797eacc314cd9c48fd
parent3db3084a86c3690e4b50b8579b0b1bbc29897375
bcachefs: add counter_flags for counters

In bcachefs, io_read and io_write counter record the amount
of data which has been read and written. They increase in
unit of sector, so to display correctly, they need to be
shifted to the left by the size of a sector. Other counters
like io_move, move_extent_{read, write, finish} also have
this problem.

In order to support different unit, we add extra column to
mark the counter type by using TYPE_COUNTER and TYPE_SECTORS
in BCH_PERSISTENT_COUNTERS().

Fixes: 1c6fdbd8f246 ("bcachefs: Initial commit")
Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/sb-counters_format.h
fs/bcachefs/sysfs.c