Skip to content

Commit 9d9d212

Browse files
author
Kent Overstreet
committed
bcachefs: bch2_extent_crc_unpacked_to_text()
Signed-off-by: Kent Overstreet <[email protected]>
1 parent 5e3c208 commit 9d9d212

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

fs/bcachefs/extents.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,18 @@ void bch2_extent_ptr_to_text(struct printbuf *out, struct bch_fs *c, const struc
10341034
--out->atomic;
10351035
}
10361036

1037+
void bch2_extent_crc_unpacked_to_text(struct printbuf *out, struct bch_extent_crc_unpacked *crc)
1038+
{
1039+
prt_printf(out, "crc: c_size %u size %u offset %u nonce %u csum ",
1040+
crc->compressed_size,
1041+
crc->uncompressed_size,
1042+
crc->offset, crc->nonce);
1043+
bch2_prt_csum_type(out, crc->csum_type);
1044+
prt_printf(out, " %0llx:%0llx ", crc->csum.hi, crc->csum.lo);
1045+
prt_str(out, " compress ");
1046+
bch2_prt_compression_type(out, crc->compression_type);
1047+
}
1048+
10371049
void bch2_bkey_ptrs_to_text(struct printbuf *out, struct bch_fs *c,
10381050
struct bkey_s_c k)
10391051
{
@@ -1059,13 +1071,7 @@ void bch2_bkey_ptrs_to_text(struct printbuf *out, struct bch_fs *c,
10591071
struct bch_extent_crc_unpacked crc =
10601072
bch2_extent_crc_unpack(k.k, entry_to_crc(entry));
10611073

1062-
prt_printf(out, "crc: c_size %u size %u offset %u nonce %u csum ",
1063-
crc.compressed_size,
1064-
crc.uncompressed_size,
1065-
crc.offset, crc.nonce);
1066-
bch2_prt_csum_type(out, crc.csum_type);
1067-
prt_str(out, " compress ");
1068-
bch2_prt_compression_type(out, crc.compression_type);
1074+
bch2_extent_crc_unpacked_to_text(out, &crc);
10691075
break;
10701076
}
10711077
case BCH_EXTENT_ENTRY_stripe_ptr: {
@@ -1096,6 +1102,7 @@ void bch2_bkey_ptrs_to_text(struct printbuf *out, struct bch_fs *c,
10961102
}
10971103
}
10981104

1105+
10991106
static int extent_ptr_invalid(struct bch_fs *c,
11001107
struct bkey_s_c k,
11011108
enum bch_validate_flags flags,

fs/bcachefs/extents.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ static inline bool crc_is_encoded(struct bch_extent_crc_unpacked crc)
212212
return crc.csum_type != BCH_CSUM_none || crc_is_compressed(crc);
213213
}
214214

215+
void bch2_extent_crc_unpacked_to_text(struct printbuf *, struct bch_extent_crc_unpacked *);
216+
215217
/* bkey_ptrs: generically over any key type that has ptrs */
216218

217219
struct bkey_ptrs_c {

0 commit comments

Comments
 (0)