Commit c387d844 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: ec_validate_checksums() -> bch2_dev_tryget()

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 8783856a
...@@ -633,19 +633,21 @@ static void ec_validate_checksums(struct bch_fs *c, struct ec_stripe_buf *buf) ...@@ -633,19 +633,21 @@ static void ec_validate_checksums(struct bch_fs *c, struct ec_stripe_buf *buf)
struct bch_csum got = ec_block_checksum(buf, i, offset); struct bch_csum got = ec_block_checksum(buf, i, offset);
if (bch2_crc_cmp(want, got)) { if (bch2_crc_cmp(want, got)) {
struct printbuf err = PRINTBUF; struct bch_dev *ca = bch2_dev_tryget(c, v->ptrs[i].dev);
struct bch_dev *ca = bch2_dev_bkey_exists(c, v->ptrs[i].dev); if (ca) {
struct printbuf err = PRINTBUF;
prt_str(&err, "stripe "); prt_str(&err, "stripe ");
bch2_csum_err_msg(&err, v->csum_type, want, got); bch2_csum_err_msg(&err, v->csum_type, want, got);
prt_printf(&err, " for %ps at %u of\n ", (void *) _RET_IP_, i); prt_printf(&err, " for %ps at %u of\n ", (void *) _RET_IP_, i);
bch2_bkey_val_to_text(&err, c, bkey_i_to_s_c(&buf->key)); bch2_bkey_val_to_text(&err, c, bkey_i_to_s_c(&buf->key));
bch_err_ratelimited(ca, "%s", err.buf); bch_err_ratelimited(ca, "%s", err.buf);
printbuf_exit(&err); printbuf_exit(&err);
clear_bit(i, buf->valid); bch2_io_error(ca, BCH_MEMBER_ERROR_checksum);
}
bch2_io_error(ca, BCH_MEMBER_ERROR_checksum); clear_bit(i, buf->valid);
break; break;
} }
......
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