Skip to content

Commit c7046ed

Browse files
author
Kent Overstreet
committed
bcachefs: Improve stripe checksum error message
We now include the name of the device in the error message - and also increment the number of checksum errors on that device. Signed-off-by: Kent Overstreet <[email protected]>
1 parent 853960d commit c7046ed

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

fs/bcachefs/ec.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -304,16 +304,21 @@ static void ec_validate_checksums(struct bch_fs *c, struct ec_stripe_buf *buf)
304304
struct bch_csum got = ec_block_checksum(buf, i, offset);
305305

306306
if (bch2_crc_cmp(want, got)) {
307-
struct printbuf buf2 = PRINTBUF;
307+
struct printbuf err = PRINTBUF;
308+
struct bch_dev *ca = bch_dev_bkey_exists(c, v->ptrs[i].dev);
309+
310+
prt_printf(&err, "stripe checksum error: expected %0llx:%0llx got %0llx:%0llx (type %s)\n",
311+
want.hi, want.lo,
312+
got.hi, got.lo,
313+
bch2_csum_types[v->csum_type]);
314+
prt_printf(&err, " for %ps at %u of\n ", (void *) _RET_IP_, i);
315+
bch2_bkey_val_to_text(&err, c, bkey_i_to_s_c(&buf->key));
316+
bch_err_ratelimited(ca, "%s", err.buf);
317+
printbuf_exit(&err);
308318

309-
bch2_bkey_val_to_text(&buf2, c, bkey_i_to_s_c(&buf->key));
310-
311-
bch_err_ratelimited(c,
312-
"stripe checksum error for %ps at %u:%u: csum type %u, expected %llx got %llx\n%s",
313-
(void *) _RET_IP_, i, j, v->csum_type,
314-
want.lo, got.lo, buf2.buf);
315-
printbuf_exit(&buf2);
316319
clear_bit(i, buf->valid);
320+
321+
bch2_io_error(ca, BCH_MEMBER_ERROR_checksum);
317322
break;
318323
}
319324

0 commit comments

Comments
 (0)