]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bcachefs: bch2_extent_crc_unpacked_to_text()
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 28 Jun 2024 20:25:39 +0000 (16:25 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 14 Jul 2024 23:00:16 +0000 (19:00 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/extents.c
fs/bcachefs/extents.h

index 410b8bd81b5a6ef8f0c0d3a9e3731e20de193bb5..057df38fccf8c88924fd132878bfdf5998f74940 100644 (file)
@@ -1034,6 +1034,18 @@ void bch2_extent_ptr_to_text(struct printbuf *out, struct bch_fs *c, const struc
        --out->atomic;
 }
 
+void bch2_extent_crc_unpacked_to_text(struct printbuf *out, struct bch_extent_crc_unpacked *crc)
+{
+       prt_printf(out, "crc: c_size %u size %u offset %u nonce %u csum ",
+                  crc->compressed_size,
+                  crc->uncompressed_size,
+                  crc->offset, crc->nonce);
+       bch2_prt_csum_type(out, crc->csum_type);
+       prt_printf(out, " %0llx:%0llx ", crc->csum.hi, crc->csum.lo);
+       prt_str(out, " compress ");
+       bch2_prt_compression_type(out, crc->compression_type);
+}
+
 void bch2_bkey_ptrs_to_text(struct printbuf *out, struct bch_fs *c,
                            struct bkey_s_c k)
 {
@@ -1059,13 +1071,7 @@ void bch2_bkey_ptrs_to_text(struct printbuf *out, struct bch_fs *c,
                        struct bch_extent_crc_unpacked crc =
                                bch2_extent_crc_unpack(k.k, entry_to_crc(entry));
 
-                       prt_printf(out, "crc: c_size %u size %u offset %u nonce %u csum ",
-                              crc.compressed_size,
-                              crc.uncompressed_size,
-                              crc.offset, crc.nonce);
-                       bch2_prt_csum_type(out, crc.csum_type);
-                       prt_str(out, " compress ");
-                       bch2_prt_compression_type(out, crc.compression_type);
+                       bch2_extent_crc_unpacked_to_text(out, &crc);
                        break;
                }
                case BCH_EXTENT_ENTRY_stripe_ptr: {
@@ -1096,6 +1102,7 @@ void bch2_bkey_ptrs_to_text(struct printbuf *out, struct bch_fs *c,
        }
 }
 
+
 static int extent_ptr_invalid(struct bch_fs *c,
                              struct bkey_s_c k,
                              enum bch_validate_flags flags,
index 1ade959652b2e6f34a3774f3ca084690bc20f600..530686aa6fd9805efd8a976d4b23beab7da5d856 100644 (file)
@@ -212,6 +212,8 @@ static inline bool crc_is_encoded(struct bch_extent_crc_unpacked crc)
        return crc.csum_type != BCH_CSUM_none || crc_is_compressed(crc);
 }
 
+void bch2_extent_crc_unpacked_to_text(struct printbuf *, struct bch_extent_crc_unpacked *);
+
 /* bkey_ptrs: generically over any key type that has ptrs */
 
 struct bkey_ptrs_c {