diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-05 11:59:03 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-05 23:24:21 -0500 |
commit | 4819b66e29893828d3efa76ecdf1ede9e036db35 (patch) | |
tree | e700d7db3b96a66c76917655859c0ab7c28d5a8c /fs/bcachefs/io_read.c | |
parent | 2d02bfb01b2743da06748ba396ff7da4425488ef (diff) | |
download | linux-stable-4819b66e29893828d3efa76ecdf1ede9e036db35.tar.gz linux-stable-4819b66e29893828d3efa76ecdf1ede9e036db35.tar.bz2 linux-stable-4819b66e29893828d3efa76ecdf1ede9e036db35.zip |
bcachefs: improve checksum error messages
new helpers:
- bch2_csum_to_text()
- bch2_csum_err_msg()
standardize our checksum error messages a bit, and print out the
checksums a bit more nicely.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/io_read.c')
-rw-r--r-- | fs/bcachefs/io_read.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/bcachefs/io_read.c b/fs/bcachefs/io_read.c index 5c2d118eaf6f..3c574d8873a1 100644 --- a/fs/bcachefs/io_read.c +++ b/fs/bcachefs/io_read.c @@ -642,12 +642,17 @@ csum_err: goto out; } + struct printbuf buf = PRINTBUF; + buf.atomic++; + prt_str(&buf, "data "); + bch2_csum_err_msg(&buf, crc.csum_type, rbio->pick.crc.csum, csum); + bch_err_inum_offset_ratelimited(ca, rbio->read_pos.inode, rbio->read_pos.offset << 9, - "data checksum error: expected %0llx:%0llx got %0llx:%0llx (type %s)", - rbio->pick.crc.csum.hi, rbio->pick.crc.csum.lo, - csum.hi, csum.lo, bch2_csum_types[crc.csum_type]); + "data %s", buf.buf); + printbuf_exit(&buf); + bch2_io_error(ca, BCH_MEMBER_ERROR_checksum); bch2_rbio_error(rbio, READ_RETRY_AVOID, BLK_STS_IOERR); goto out; |