Commit 08061519 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Don't ratelimit certain fsck errors

It's unhelpful if we see "Halting mark and sweep to start topology
repair" but we don't see the error that triggered it.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent 33a1f84b
...@@ -86,7 +86,11 @@ static int bch2_gc_check_topology(struct bch_fs *c, ...@@ -86,7 +86,11 @@ static int bch2_gc_check_topology(struct bch_fs *c,
if (bpos_cmp(expected_start, bp->v.min_key)) { if (bpos_cmp(expected_start, bp->v.min_key)) {
bch2_topology_error(c); bch2_topology_error(c);
if (fsck_err(c, "btree node with incorrect min_key at btree %s level %u:\n" if (__fsck_err(c,
FSCK_CAN_FIX|
FSCK_CAN_IGNORE|
FSCK_NO_RATELIMIT,
"btree node with incorrect min_key at btree %s level %u:\n"
" prev %s\n" " prev %s\n"
" cur %s", " cur %s",
bch2_btree_ids[b->c.btree_id], b->c.level, bch2_btree_ids[b->c.btree_id], b->c.level,
...@@ -103,7 +107,11 @@ static int bch2_gc_check_topology(struct bch_fs *c, ...@@ -103,7 +107,11 @@ static int bch2_gc_check_topology(struct bch_fs *c,
if (is_last && bpos_cmp(cur.k->k.p, node_end)) { if (is_last && bpos_cmp(cur.k->k.p, node_end)) {
bch2_topology_error(c); bch2_topology_error(c);
if (fsck_err(c, "btree node with incorrect max_key at btree %s level %u:\n" if (__fsck_err(c,
FSCK_CAN_FIX|
FSCK_CAN_IGNORE|
FSCK_NO_RATELIMIT,
"btree node with incorrect max_key at btree %s level %u:\n"
" %s\n" " %s\n"
" expected %s", " expected %s",
bch2_btree_ids[b->c.btree_id], b->c.level, bch2_btree_ids[b->c.btree_id], b->c.level,
...@@ -884,7 +892,11 @@ static int bch2_gc_btree_init_recurse(struct bch_fs *c, struct btree *b, ...@@ -884,7 +892,11 @@ static int bch2_gc_btree_init_recurse(struct bch_fs *c, struct btree *b,
if (ret == -EIO) { if (ret == -EIO) {
bch2_topology_error(c); bch2_topology_error(c);
if (fsck_err(c, "Unreadable btree node at btree %s level %u:\n" if (__fsck_err(c,
FSCK_CAN_FIX|
FSCK_CAN_IGNORE|
FSCK_NO_RATELIMIT,
"Unreadable btree node at btree %s level %u:\n"
" %s", " %s",
bch2_btree_ids[b->c.btree_id], bch2_btree_ids[b->c.btree_id],
b->c.level - 1, b->c.level - 1,
......
...@@ -111,6 +111,7 @@ enum fsck_err_ret bch2_fsck_err(struct bch_fs *c, unsigned flags, ...@@ -111,6 +111,7 @@ enum fsck_err_ret bch2_fsck_err(struct bch_fs *c, unsigned flags,
list_move(&s->list, &c->fsck_errors); list_move(&s->list, &c->fsck_errors);
s->nr++; s->nr++;
if (c->opts.ratelimit_errors && if (c->opts.ratelimit_errors &&
!(flags & FSCK_NO_RATELIMIT) &&
s->nr >= FSCK_ERR_RATELIMIT_NR) { s->nr >= FSCK_ERR_RATELIMIT_NR) {
if (s->nr == FSCK_ERR_RATELIMIT_NR) if (s->nr == FSCK_ERR_RATELIMIT_NR)
suppressing = true; suppressing = true;
......
...@@ -104,6 +104,7 @@ struct fsck_err_state { ...@@ -104,6 +104,7 @@ struct fsck_err_state {
#define FSCK_CAN_FIX (1 << 0) #define FSCK_CAN_FIX (1 << 0)
#define FSCK_CAN_IGNORE (1 << 1) #define FSCK_CAN_IGNORE (1 << 1)
#define FSCK_NEED_FSCK (1 << 2) #define FSCK_NEED_FSCK (1 << 2)
#define FSCK_NO_RATELIMIT (1 << 3)
__printf(3, 4) __cold __printf(3, 4) __cold
enum fsck_err_ret bch2_fsck_err(struct bch_fs *, enum fsck_err_ret bch2_fsck_err(struct bch_fs *,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment