mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
bcachefs: Improve journal_entry_btree_keys_to_text()
This improves the formatting of journal_entry_btree_keys_to_text() by putting each key on its own line. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
33aa419db9
commit
e7bc7cdff8
2 changed files with 31 additions and 3 deletions
|
@ -298,11 +298,17 @@ static void journal_entry_btree_keys_to_text(struct printbuf *out, struct bch_fs
|
||||||
struct jset_entry *entry)
|
struct jset_entry *entry)
|
||||||
{
|
{
|
||||||
struct bkey_i *k;
|
struct bkey_i *k;
|
||||||
|
bool first = true;
|
||||||
|
|
||||||
pr_buf(out, "btree=%s l=%u ", bch2_btree_ids[entry->btree_id], entry->level);
|
vstruct_for_each(entry, k) {
|
||||||
|
if (!first) {
|
||||||
vstruct_for_each(entry, k)
|
printbuf_newline(out);
|
||||||
|
pr_buf(out, "%s: ", bch2_jset_entry_types[entry->type]);
|
||||||
|
}
|
||||||
|
pr_buf(out, "btree=%s l=%u ", bch2_btree_ids[entry->btree_id], entry->level);
|
||||||
bch2_bkey_val_to_text(out, c, bkey_i_to_s_c(k));
|
bch2_bkey_val_to_text(out, c, bkey_i_to_s_c(k));
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int journal_entry_btree_root_validate(struct bch_fs *c,
|
static int journal_entry_btree_root_validate(struct bch_fs *c,
|
||||||
|
|
|
@ -238,6 +238,7 @@ do { \
|
||||||
struct printbuf {
|
struct printbuf {
|
||||||
char *pos;
|
char *pos;
|
||||||
char *end;
|
char *end;
|
||||||
|
unsigned indent;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline size_t printbuf_remaining(struct printbuf *buf)
|
static inline size_t printbuf_remaining(struct printbuf *buf)
|
||||||
|
@ -259,6 +260,27 @@ do { \
|
||||||
__VA_ARGS__); \
|
__VA_ARGS__); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
static inline void printbuf_indent_push(struct printbuf *buf, unsigned spaces)
|
||||||
|
{
|
||||||
|
buf->indent += spaces;
|
||||||
|
while (spaces--)
|
||||||
|
pr_buf(buf, " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void printbuf_indent_pop(struct printbuf *buf, unsigned spaces)
|
||||||
|
{
|
||||||
|
buf->indent -= spaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void printbuf_newline(struct printbuf *buf)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
pr_buf(buf, "\n");
|
||||||
|
for (i = 0; i < buf->indent; i++)
|
||||||
|
pr_buf(buf, " ");
|
||||||
|
}
|
||||||
|
|
||||||
void bch_scnmemcpy(struct printbuf *, const char *, size_t);
|
void bch_scnmemcpy(struct printbuf *, const char *, size_t);
|
||||||
|
|
||||||
int bch2_strtoint_h(const char *, int *);
|
int bch2_strtoint_h(const char *, int *);
|
||||||
|
|
Loading…
Add table
Reference in a new issue