summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/super.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-10-25 16:29:37 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-11-01 21:11:08 -0400
commit94119eeb02d114aa1f78dcfaabdca50b9b626790 (patch)
treeff13ee14b7f0aee14a85fa3805ac38dd6cd35e97 /fs/bcachefs/super.c
parent5394fe9494011de19baff276ce02a2f00eef568a (diff)
downloadlinux-94119eeb02d114aa1f78dcfaabdca50b9b626790.tar.gz
linux-94119eeb02d114aa1f78dcfaabdca50b9b626790.tar.bz2
linux-94119eeb02d114aa1f78dcfaabdca50b9b626790.zip
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 <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super.c')
-rw-r--r--fs/bcachefs/super.c5
1 files changed, 5 insertions, 0 deletions
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,