bcachefs: Suppresss various error messages in no_data_io mode
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 17 Jul 2023 02:31:19 +0000 (22:31 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:10:08 +0000 (17:10 -0400)
We commonly use no_data_io mode when debugging filesystem metadata
dumps, where data checksum/compression errors are expected and
unimportant - this patch suppresses these.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/checksum.c
fs/bcachefs/compress.c
fs/bcachefs/io.c

index 20d0e8afc1adbfd89a3f4e130cef0db086b1f851..bf03d42c6138e4737976875387d2c7d2d02394de 100644 (file)
@@ -426,7 +426,7 @@ int bch2_rechecksum_bio(struct bch_fs *c, struct bio *bio,
                merged = bch2_checksum_bio(c, crc_old.csum_type,
                                extent_nonce(version, crc_old), bio);
 
-       if (bch2_crc_cmp(merged, crc_old.csum)) {
+       if (bch2_crc_cmp(merged, crc_old.csum) && !c->opts.no_data_io) {
                bch_err(c, "checksum error in bch2_rechecksum_bio() (memory corruption or bug?)\n"
                        "expected %0llx:%0llx got %0llx:%0llx (old type %s new type %s)",
                        crc_old.csum.hi,
index 560214c15da3c99d98be131299e6f5c632abf166..c9ca7cce55f870b0a32921ce767cf4521aab5943 100644 (file)
@@ -240,7 +240,8 @@ int bch2_bio_uncompress_inplace(struct bch_fs *c, struct bio *bio,
        data = __bounce_alloc(c, dst_len, WRITE);
 
        if (__bio_uncompress(c, bio, data.b, *crc)) {
-               bch_err(c, "error rewriting existing data: decompression error");
+               if (!c->opts.no_data_io)
+                       bch_err(c, "error rewriting existing data: decompression error");
                bio_unmap_or_unbounce(c, data);
                return -EIO;
        }
index 8604df80a3e2a6040c712754344df39f7e479472..5bacc6a9dd8fb57cc6e58610db92b006fb0e3f80 100644 (file)
@@ -1082,7 +1082,8 @@ static enum prep_encoded_ret {
             op->incompressible)) {
                if (!crc_is_compressed(op->crc) &&
                    op->csum_type != op->crc.csum_type &&
-                   bch2_write_rechecksum(c, op, op->csum_type))
+                   bch2_write_rechecksum(c, op, op->csum_type) &&
+                   !c->opts.no_data_io)
                        return PREP_ENCODED_CHECKSUM_ERR;
 
                return PREP_ENCODED_DO_WRITE;
@@ -1102,7 +1103,7 @@ static enum prep_encoded_ret {
                csum = bch2_checksum_bio(c, op->crc.csum_type,
                                         extent_nonce(op->version, op->crc),
                                         bio);
-               if (bch2_crc_cmp(op->crc.csum, csum))
+               if (bch2_crc_cmp(op->crc.csum, csum) && !c->opts.no_data_io)
                        return PREP_ENCODED_CHECKSUM_ERR;
 
                if (bch2_bio_uncompress_inplace(c, bio, &op->crc))
@@ -1120,7 +1121,8 @@ static enum prep_encoded_ret {
         */
        if ((op->crc.live_size != op->crc.uncompressed_size ||
             op->crc.csum_type != op->csum_type) &&
-           bch2_write_rechecksum(c, op, op->csum_type))
+           bch2_write_rechecksum(c, op, op->csum_type) &&
+           !c->opts.no_data_io)
                return PREP_ENCODED_CHECKSUM_ERR;
 
        /*
@@ -2416,7 +2418,8 @@ static void __bch2_read_endio(struct work_struct *work)
                if (ret)
                        goto decrypt_err;
 
-               if (bch2_bio_uncompress(c, src, dst, dst_iter, crc))
+               if (bch2_bio_uncompress(c, src, dst, dst_iter, crc) &&
+                   !c->opts.no_data_io)
                        goto decompression_err;
        } else {
                /* don't need to decrypt the entire bio: */