summaryrefslogtreecommitdiff
path: root/fs/bcachefs/alloc_background.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-07-12 04:06:52 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:35 +0300
commit80b3bf33d35e8f5bf4323be71777e9aab66c3a90 (patch)
tree5ada95c144df8c2a8c7046390d6141ae73c3d4c8 /fs/bcachefs/alloc_background.c
parent1534ebb706efe9765787c0899dfa5ec52331ba8f (diff)
downloadlinux-80b3bf33d35e8f5bf4323be71777e9aab66c3a90.tar.xz
bcachefs: Silence some fsck errors when reconstructing alloc info
There's no need to print fsck errors for errors that are expected, and the user has already opted to repair. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/alloc_background.c')
-rw-r--r--fs/bcachefs/alloc_background.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index f4457d62d75e..a511ab9e4e7c 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -652,12 +652,13 @@ static int bch2_check_alloc_key(struct btree_trans *trans,
if (ret)
goto err;
- if (fsck_err_on(k.k->type != discard_key_type, c,
- "incorrect key in need_discard btree (got %s should be %s)\n"
- " %s",
- bch2_bkey_types[k.k->type],
- bch2_bkey_types[discard_key_type],
- (bch2_bkey_val_to_text(&buf, c, alloc_k), buf.buf))) {
+ if (k.k->type != discard_key_type &&
+ (c->opts.reconstruct_alloc ||
+ fsck_err(c, "incorrect key in need_discard btree (got %s should be %s)\n"
+ " %s",
+ bch2_bkey_types[k.k->type],
+ bch2_bkey_types[discard_key_type],
+ (bch2_bkey_val_to_text(&buf, c, alloc_k), buf.buf)))) {
struct bkey_i *update =
bch2_trans_kmalloc(trans, sizeof(*update));
@@ -679,13 +680,14 @@ static int bch2_check_alloc_key(struct btree_trans *trans,
if (ret)
goto err;
- if (fsck_err_on(k.k->type != freespace_key_type, c,
- "incorrect key in freespace btree (got %s should be %s)\n"
- " %s",
- bch2_bkey_types[k.k->type],
- bch2_bkey_types[freespace_key_type],
- (printbuf_reset(&buf),
- bch2_bkey_val_to_text(&buf, c, alloc_k), buf.buf))) {
+ if (k.k->type != freespace_key_type &&
+ (c->opts.reconstruct_alloc ||
+ fsck_err(c, "incorrect key in freespace btree (got %s should be %s)\n"
+ " %s",
+ bch2_bkey_types[k.k->type],
+ bch2_bkey_types[freespace_key_type],
+ (printbuf_reset(&buf),
+ bch2_bkey_val_to_text(&buf, c, alloc_k), buf.buf)))) {
struct bkey_i *update =
bch2_trans_kmalloc(trans, sizeof(*update));