summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/error.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-11-06 15:32:11 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:31 -0400
commite2ee3eaab72a059b29f079290b5773509df9524f (patch)
treecd66c550f6cc68a395f68150c9941dab2541d095 /fs/bcachefs/error.c
parentef496cd268f45351820c3d268d01bd46c8b80b04 (diff)
downloadlinux-e2ee3eaab72a059b29f079290b5773509df9524f.tar.gz
linux-e2ee3eaab72a059b29f079290b5773509df9524f.tar.bz2
linux-e2ee3eaab72a059b29f079290b5773509df9524f.zip
bcachefs: Add an option for fsck error ratelimiting
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/error.c')
-rw-r--r--fs/bcachefs/error.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/bcachefs/error.c b/fs/bcachefs/error.c
index 304ff92500be..5a5cfee623e2 100644
--- a/fs/bcachefs/error.c
+++ b/fs/bcachefs/error.c
@@ -64,7 +64,7 @@ void bch2_io_error(struct bch_dev *ca)
enum fsck_err_ret bch2_fsck_err(struct bch_fs *c, unsigned flags,
const char *fmt, ...)
{
- struct fsck_err_state *s;
+ struct fsck_err_state *s = NULL;
va_list args;
bool fix = false, print = true, suppressing = false;
char _buf[sizeof(s->buf)], *buf = _buf;
@@ -99,8 +99,13 @@ enum fsck_err_ret bch2_fsck_err(struct bch_fs *c, unsigned flags,
found:
list_move(&s->list, &c->fsck_errors);
s->nr++;
- suppressing = s->nr == FSCK_ERR_RATELIMIT_NR;
- print = s->nr <= FSCK_ERR_RATELIMIT_NR;
+ if (c->opts.ratelimit_errors &&
+ s->nr >= FSCK_ERR_RATELIMIT_NR) {
+ if (s->nr == FSCK_ERR_RATELIMIT_NR)
+ suppressing = true;
+ else
+ print = false;
+ }
buf = s->buf;
print:
va_start(args, fmt);
@@ -156,7 +161,7 @@ void bch2_flush_fsck_errs(struct bch_fs *c)
mutex_lock(&c->fsck_error_lock);
list_for_each_entry_safe(s, n, &c->fsck_errors, list) {
- if (s->nr > FSCK_ERR_RATELIMIT_NR)
+ if (s->ratelimited)
bch_err(c, "Saw %llu errors like:\n %s", s->nr, s->buf);
list_del(&s->list);