bcachefs: Error ratelimiting is no longer only during fsck
We now more often do repair automatically, without the user invoking fsck - and sometimes that can involve fixing lots of errors, so let's avoid flooding the dmesg log. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
+12
-5
@@ -272,9 +272,6 @@ static struct fsck_err_state *fsck_err_get(struct bch_fs *c,
|
||||
{
|
||||
struct fsck_err_state *s;
|
||||
|
||||
if (!test_bit(BCH_FS_fsck_running, &c->flags))
|
||||
return NULL;
|
||||
|
||||
list_for_each_entry(s, &c->fsck_error_msgs, list)
|
||||
if (s->id == id) {
|
||||
/*
|
||||
@@ -639,14 +636,14 @@ int __bch2_bkey_fsck_err(struct bch_fs *c,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void bch2_flush_fsck_errs(struct bch_fs *c)
|
||||
static void __bch2_flush_fsck_errs(struct bch_fs *c, bool print)
|
||||
{
|
||||
struct fsck_err_state *s, *n;
|
||||
|
||||
mutex_lock(&c->fsck_error_msgs_lock);
|
||||
|
||||
list_for_each_entry_safe(s, n, &c->fsck_error_msgs, list) {
|
||||
if (s->ratelimited && s->last_msg)
|
||||
if (print && s->ratelimited && s->last_msg)
|
||||
bch_err(c, "Saw %llu errors like:\n %s", s->nr, s->last_msg);
|
||||
|
||||
list_del(&s->list);
|
||||
@@ -657,6 +654,16 @@ void bch2_flush_fsck_errs(struct bch_fs *c)
|
||||
mutex_unlock(&c->fsck_error_msgs_lock);
|
||||
}
|
||||
|
||||
void bch2_flush_fsck_errs(struct bch_fs *c)
|
||||
{
|
||||
__bch2_flush_fsck_errs(c, true);
|
||||
}
|
||||
|
||||
void bch2_free_fsck_errs(struct bch_fs *c)
|
||||
{
|
||||
__bch2_flush_fsck_errs(c, false);
|
||||
}
|
||||
|
||||
int bch2_inum_offset_err_msg_trans(struct btree_trans *trans, struct printbuf *out,
|
||||
subvol_inum inum, u64 offset)
|
||||
{
|
||||
|
||||
@@ -93,6 +93,7 @@ int __bch2_fsck_err(struct bch_fs *, struct btree_trans *,
|
||||
_flags, BCH_FSCK_ERR_##_err_type, __VA_ARGS__)
|
||||
|
||||
void bch2_flush_fsck_errs(struct bch_fs *);
|
||||
void bch2_free_fsck_errs(struct bch_fs *);
|
||||
|
||||
#define fsck_err_wrap(_do) \
|
||||
({ \
|
||||
|
||||
@@ -552,6 +552,7 @@ static void __bch2_fs_free(struct bch_fs *c)
|
||||
|
||||
bch2_find_btree_nodes_exit(&c->found_btree_nodes);
|
||||
bch2_free_pending_node_rewrites(c);
|
||||
bch2_free_fsck_errs(c);
|
||||
bch2_fs_accounting_exit(c);
|
||||
bch2_fs_sb_errors_exit(c);
|
||||
bch2_fs_counters_exit(c);
|
||||
|
||||
Reference in New Issue
Block a user