void bch_extent_to_text(char *buf, size_t size, const struct bkey *k) { unsigned i = 0; char *out = buf, *end = buf + size; #define p(...) (out += scnprintf(out, end - out, __VA_ARGS__)) p("%llu:%llu len %llu -> [", KEY_INODE(k), KEY_START(k), KEY_SIZE(k)); for (i = 0; i < KEY_PTRS(k); i++) { if (i) p(", "); if (PTR_DEV(k, i) == PTR_CHECK_DEV) p("check dev"); else p("%llu:%llu gen %llu", PTR_DEV(k, i), PTR_OFFSET(k, i), PTR_GEN(k, i)); } p("]"); if (KEY_DIRTY(k)) p(" dirty"); if (KEY_CSUM(k)) p(" cs%llu %llx", KEY_CSUM(k), k->ptr[1]); #undef p }
struct keyprint_hack bch_pkey(const struct bkey *k) { unsigned i = 0; struct keyprint_hack r; char *out = r.s, *end = r.s + KEYHACK_SIZE; #define p(...) (out += scnprintf(out, end - out, __VA_ARGS__)) p("%llu:%llu len %llu -> [", KEY_INODE(k), KEY_OFFSET(k), KEY_SIZE(k)); if (KEY_PTRS(k)) while (1) { p("%llu:%llu gen %llu", PTR_DEV(k, i), PTR_OFFSET(k, i), PTR_GEN(k, i)); if (++i == KEY_PTRS(k)) break; p(", "); } p("]"); if (KEY_DIRTY(k)) p(" dirty"); if (KEY_CSUM(k)) p(" cs%llu %llx", KEY_CSUM(k), k->ptr[1]); #undef p return r; }