summaryrefslogtreecommitdiff
path: root/fs/bcachefs/io.c
diff options
context:
space:
mode:
authorDaniel Hill <daniel@gluo.nz>2022-03-15 21:36:33 +1300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:32 -0400
commit104c69745fdf7e5f8aa022f60bc9d568987bd8b8 (patch)
tree09fc07cf3d1bbe991c7a586fbac4ee24c31d1b98 /fs/bcachefs/io.c
parent1f93726e6347938343190913cb959623e67ecf78 (diff)
downloadlwn-104c69745fdf7e5f8aa022f60bc9d568987bd8b8.tar.gz
lwn-104c69745fdf7e5f8aa022f60bc9d568987bd8b8.zip
bcachefs: Add persistent counters
This adds a new superblock field for persisting counters and adds a sysfs interface in counters/ exposing these counters. The superblock field is ignored by older versions letting us avoid an on disk version bump. Each sysfs file outputs a counter that tracks since filesystem creation and a counter for the current mount session. Signed-off-by: Daniel Hill <daniel@gluo.nz> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/io.c')
-rw-r--r--fs/bcachefs/io.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index 0f80255e59bd..f20891d48ca8 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -1403,6 +1403,7 @@ void bch2_write(struct closure *cl)
goto err;
}
+ this_cpu_add(c->counters[BCH_COUNTER_io_write], bio_sectors(bio));
bch2_increment_clock(c, bio_sectors(bio), WRITE);
data_len = min_t(u64, bio->bi_iter.bi_size,
@@ -2310,6 +2311,7 @@ get_bio:
if (rbio->bounce)
trace_read_bounce(&rbio->bio);
+ this_cpu_add(c->counters[BCH_COUNTER_io_read], bio_sectors(&rbio->bio));
bch2_increment_clock(c, bio_sectors(&rbio->bio), READ);
/*