bcachefs: trivial extents.c refactoring
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
48f866e90f
commit
ef435abd6a
@ -992,10 +992,6 @@ void bch2_bkey_ptrs_to_text(struct printbuf *out, struct bch_fs *c,
|
|||||||
{
|
{
|
||||||
struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k);
|
struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k);
|
||||||
const union bch_extent_entry *entry;
|
const union bch_extent_entry *entry;
|
||||||
struct bch_extent_crc_unpacked crc;
|
|
||||||
const struct bch_extent_ptr *ptr;
|
|
||||||
const struct bch_extent_stripe_ptr *ec;
|
|
||||||
struct bch_dev *ca;
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
if (c)
|
if (c)
|
||||||
@ -1006,9 +1002,9 @@ void bch2_bkey_ptrs_to_text(struct printbuf *out, struct bch_fs *c,
|
|||||||
prt_printf(out, " ");
|
prt_printf(out, " ");
|
||||||
|
|
||||||
switch (__extent_entry_type(entry)) {
|
switch (__extent_entry_type(entry)) {
|
||||||
case BCH_EXTENT_ENTRY_ptr:
|
case BCH_EXTENT_ENTRY_ptr: {
|
||||||
ptr = entry_to_ptr(entry);
|
const struct bch_extent_ptr *ptr = entry_to_ptr(entry);
|
||||||
ca = c && ptr->dev < c->sb.nr_devices && c->devs[ptr->dev]
|
struct bch_dev *ca = c && ptr->dev < c->sb.nr_devices && c->devs[ptr->dev]
|
||||||
? bch_dev_bkey_exists(c, ptr->dev)
|
? bch_dev_bkey_exists(c, ptr->dev)
|
||||||
: NULL;
|
: NULL;
|
||||||
|
|
||||||
@ -1030,10 +1026,12 @@ void bch2_bkey_ptrs_to_text(struct printbuf *out, struct bch_fs *c,
|
|||||||
prt_printf(out, " stale");
|
prt_printf(out, " stale");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case BCH_EXTENT_ENTRY_crc32:
|
case BCH_EXTENT_ENTRY_crc32:
|
||||||
case BCH_EXTENT_ENTRY_crc64:
|
case BCH_EXTENT_ENTRY_crc64:
|
||||||
case BCH_EXTENT_ENTRY_crc128:
|
case BCH_EXTENT_ENTRY_crc128: {
|
||||||
crc = bch2_extent_crc_unpack(k.k, entry_to_crc(entry));
|
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 %s compress %s",
|
prt_printf(out, "crc: c_size %u size %u offset %u nonce %u csum %s compress %s",
|
||||||
crc.compressed_size,
|
crc.compressed_size,
|
||||||
@ -1042,12 +1040,14 @@ void bch2_bkey_ptrs_to_text(struct printbuf *out, struct bch_fs *c,
|
|||||||
bch2_csum_types[crc.csum_type],
|
bch2_csum_types[crc.csum_type],
|
||||||
bch2_compression_types[crc.compression_type]);
|
bch2_compression_types[crc.compression_type]);
|
||||||
break;
|
break;
|
||||||
case BCH_EXTENT_ENTRY_stripe_ptr:
|
}
|
||||||
ec = &entry->stripe_ptr;
|
case BCH_EXTENT_ENTRY_stripe_ptr: {
|
||||||
|
const struct bch_extent_stripe_ptr *ec = &entry->stripe_ptr;
|
||||||
|
|
||||||
prt_printf(out, "ec: idx %llu block %u",
|
prt_printf(out, "ec: idx %llu block %u",
|
||||||
(u64) ec->idx, ec->block);
|
(u64) ec->idx, ec->block);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
prt_printf(out, "(invalid extent entry %.16llx)", *((u64 *) entry));
|
prt_printf(out, "(invalid extent entry %.16llx)", *((u64 *) entry));
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user