From 94119eeb02d114aa1f78dcfaabdca50b9b626790 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Wed, 25 Oct 2023 16:29:37 -0400 Subject: bcachefs: Add IO error counts to bch_member We now track IO errors per device since filesystem creation. IO error counts can be viewed in sysfs, or with the 'bcachefs show-super' command. Signed-off-by: Kent Overstreet --- fs/bcachefs/super.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'fs/bcachefs/super.c') diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index 835342b56003..e16b5bc12d26 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -1131,6 +1131,7 @@ static struct bch_dev *__bch2_dev_alloc(struct bch_fs *c, struct bch_member *member) { struct bch_dev *ca; + unsigned i; ca = kzalloc(sizeof(*ca), GFP_KERNEL); if (!ca) @@ -1148,6 +1149,10 @@ static struct bch_dev *__bch2_dev_alloc(struct bch_fs *c, bch2_time_stats_init(&ca->io_latency[WRITE]); ca->mi = bch2_mi_to_cpu(member); + + for (i = 0; i < ARRAY_SIZE(member->errors); i++) + atomic64_set(&ca->errors[i], le64_to_cpu(member->errors[i])); + ca->uuid = member->uuid; ca->nr_btree_reserve = DIV_ROUND_UP(BTREE_NODE_RESERVE, -- cgit v1.2.3