Commit 1d81313f authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Make __bch2_journal_debug_to_text() more readable

Switch to one line of output per pr_buf() call - longer lines but quite
a bit more readable.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent 50671786
...@@ -1134,44 +1134,29 @@ void __bch2_journal_debug_to_text(struct printbuf *out, struct journal *j) ...@@ -1134,44 +1134,29 @@ void __bch2_journal_debug_to_text(struct printbuf *out, struct journal *j)
struct bch_fs *c = container_of(j, struct bch_fs, journal); struct bch_fs *c = container_of(j, struct bch_fs, journal);
union journal_res_state s; union journal_res_state s;
struct bch_dev *ca; struct bch_dev *ca;
unsigned long now = jiffies;
unsigned i; unsigned i;
rcu_read_lock(); rcu_read_lock();
s = READ_ONCE(j->reservations); s = READ_ONCE(j->reservations);
pr_buf(out, pr_buf(out, "active journal entries:\t%llu\n", fifo_used(&j->pin));
"active journal entries:\t%llu\n" pr_buf(out, "seq:\t\t\t%llu\n", journal_cur_seq(j));
"seq:\t\t\t%llu\n" pr_buf(out, "last_seq:\t\t%llu\n", journal_last_seq(j));
"last_seq:\t\t%llu\n" pr_buf(out, "last_seq_ondisk:\t%llu\n", j->last_seq_ondisk);
"last_seq_ondisk:\t%llu\n" pr_buf(out, "flushed_seq_ondisk:\t%llu\n", j->flushed_seq_ondisk);
"flushed_seq_ondisk:\t%llu\n" pr_buf(out, "prereserved:\t\t%u/%u\n", j->prereserved.reserved, j->prereserved.remaining);
"prereserved:\t\t%u/%u\n" pr_buf(out, "each entry reserved:\t%u\n", j->entry_u64s_reserved);
"each entry reserved:\t%u\n" pr_buf(out, "nr flush writes:\t%llu\n", j->nr_flush_writes);
"nr flush writes:\t%llu\n" pr_buf(out, "nr noflush writes:\t%llu\n", j->nr_noflush_writes);
"nr noflush writes:\t%llu\n" pr_buf(out, "nr direct reclaim:\t%llu\n", j->nr_direct_reclaim);
"nr direct reclaim:\t%llu\n" pr_buf(out, "nr background reclaim:\t%llu\n", j->nr_background_reclaim);
"nr background reclaim:\t%llu\n" pr_buf(out, "reclaim kicked:\t\t%u\n", j->reclaim_kicked);
"reclaim kicked:\t\t%u\n" pr_buf(out, "reclaim runs in:\t%u ms\n", time_after(j->next_reclaim, now)
"reclaim runs in:\t%u ms\n" ? jiffies_to_msecs(j->next_reclaim - jiffies) : 0);
"current entry sectors:\t%u\n" pr_buf(out, "current entry sectors:\t%u\n", j->cur_entry_sectors);
"current entry error:\t%u\n" pr_buf(out, "current entry error:\t%u\n", j->cur_entry_error);
"current entry:\t\t", pr_buf(out, "current entry:\t\t");
fifo_used(&j->pin),
journal_cur_seq(j),
journal_last_seq(j),
j->last_seq_ondisk,
j->flushed_seq_ondisk,
j->prereserved.reserved,
j->prereserved.remaining,
j->entry_u64s_reserved,
j->nr_flush_writes,
j->nr_noflush_writes,
j->nr_direct_reclaim,
j->nr_background_reclaim,
j->reclaim_kicked,
jiffies_to_msecs(j->next_reclaim - jiffies),
j->cur_entry_sectors,
j->cur_entry_error);
switch (s.cur_entry_offset) { switch (s.cur_entry_offset) {
case JOURNAL_ENTRY_ERROR_VAL: case JOURNAL_ENTRY_ERROR_VAL:
...@@ -1181,15 +1166,11 @@ void __bch2_journal_debug_to_text(struct printbuf *out, struct journal *j) ...@@ -1181,15 +1166,11 @@ void __bch2_journal_debug_to_text(struct printbuf *out, struct journal *j)
pr_buf(out, "closed\n"); pr_buf(out, "closed\n");
break; break;
default: default:
pr_buf(out, "%u/%u\n", pr_buf(out, "%u/%u\n", s.cur_entry_offset, j->cur_entry_u64s);
s.cur_entry_offset,
j->cur_entry_u64s);
break; break;
} }
pr_buf(out, pr_buf(out, "current entry:\t\tidx %u refcount %u\n", s.idx, journal_state_count(s, s.idx));
"current entry:\t\tidx %u refcount %u\n",
s.idx, journal_state_count(s, s.idx));
i = s.idx; i = s.idx;
while (i != s.unwritten_idx) { while (i != s.unwritten_idx) {
...@@ -1229,22 +1210,14 @@ void __bch2_journal_debug_to_text(struct printbuf *out, struct journal *j) ...@@ -1229,22 +1210,14 @@ void __bch2_journal_debug_to_text(struct printbuf *out, struct journal *j)
if (!ja->nr) if (!ja->nr)
continue; continue;
pr_buf(out, pr_buf(out, "dev %u:\n", i);
"dev %u:\n" pr_buf(out, "\tnr\t\t%u\n", ja->nr);
"\tnr\t\t%u\n" pr_buf(out, "\tbucket size\t%u\n", ca->mi.bucket_size);
"\tbucket size\t%u\n" pr_buf(out, "\tavailable\t%u:%u\n", bch2_journal_dev_buckets_available(j, ja, journal_space_discarded), ja->sectors_free);
"\tavailable\t%u:%u\n" pr_buf(out, "\tdiscard_idx\t%u\n", ja->discard_idx);
"\tdiscard_idx\t%u\n" pr_buf(out, "\tdirty_ondisk\t%u (seq %llu)\n", ja->dirty_idx_ondisk, ja->bucket_seq[ja->dirty_idx_ondisk]);
"\tdirty_ondisk\t%u (seq %llu)\n" pr_buf(out, "\tdirty_idx\t%u (seq %llu)\n", ja->dirty_idx, ja->bucket_seq[ja->dirty_idx]);
"\tdirty_idx\t%u (seq %llu)\n" pr_buf(out, "\tcur_idx\t\t%u (seq %llu)\n", ja->cur_idx, ja->bucket_seq[ja->cur_idx]);
"\tcur_idx\t\t%u (seq %llu)\n",
i, ja->nr, ca->mi.bucket_size,
bch2_journal_dev_buckets_available(j, ja, journal_space_discarded),
ja->sectors_free,
ja->discard_idx,
ja->dirty_idx_ondisk, ja->bucket_seq[ja->dirty_idx_ondisk],
ja->dirty_idx, ja->bucket_seq[ja->dirty_idx],
ja->cur_idx, ja->bucket_seq[ja->cur_idx]);
} }
rcu_read_unlock(); rcu_read_unlock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment