summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/ec.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-02-24 19:26:03 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:54 -0400
commit0d763863af0b1d70dcb64e515df4b9242bc9c28d (patch)
treede70b0196a89205d803b44a595a758a4c4d1c01e /fs/bcachefs/ec.c
parent33669e0cc94e9554cf162cbe2e63155887a10231 (diff)
downloadlinux-stable-0d763863af0b1d70dcb64e515df4b9242bc9c28d.tar.gz
linux-stable-0d763863af0b1d70dcb64e515df4b9242bc9c28d.tar.bz2
linux-stable-0d763863af0b1d70dcb64e515df4b9242bc9c28d.zip
bcachefs: Improve bch2_stripe_to_text()
We now print pointers as bucket:offset, the same as how we print extent pointers. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/ec.c')
-rw-r--r--fs/bcachefs/ec.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c
index b711f33f0e03..473f1c09e106 100644
--- a/fs/bcachefs/ec.c
+++ b/fs/bcachefs/ec.c
@@ -138,20 +138,28 @@ void bch2_stripe_to_text(struct printbuf *out, struct bch_fs *c,
struct bkey_s_c k)
{
const struct bch_stripe *s = bkey_s_c_to_stripe(k).v;
- unsigned i;
+ unsigned i, nr_data = s->nr_blocks - s->nr_redundant;
prt_printf(out, "algo %u sectors %u blocks %u:%u csum %u gran %u",
s->algorithm,
le16_to_cpu(s->sectors),
- s->nr_blocks - s->nr_redundant,
+ nr_data,
s->nr_redundant,
s->csum_type,
1U << s->csum_granularity_bits);
- for (i = 0; i < s->nr_blocks; i++)
- prt_printf(out, " %u:%llu:%u", s->ptrs[i].dev,
- (u64) s->ptrs[i].offset,
- stripe_blockcount_get(s, i));
+ for (i = 0; i < s->nr_blocks; i++) {
+ const struct bch_extent_ptr *ptr = s->ptrs + i;
+ struct bch_dev *ca = bch_dev_bkey_exists(c, ptr->dev);
+ u32 offset;
+ u64 b = sector_to_bucket_and_offset(ca, ptr->offset, &offset);
+
+ prt_printf(out, " %u:%llu:%u", ptr->dev, b, offset);
+ if (i < nr_data)
+ prt_printf(out, "#%u", stripe_blockcount_get(s, i));
+ if (ptr_stale(ca, ptr))
+ prt_printf(out, " stale");
+ }
}
/* returns blocknr in stripe that we matched: */