Commit 7423330e authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: prt_printf() now respects \r\n\t

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 2dcb605e
...@@ -330,27 +330,17 @@ void bch2_alloc_to_text(struct printbuf *out, struct bch_fs *c, struct bkey_s_c ...@@ -330,27 +330,17 @@ void bch2_alloc_to_text(struct printbuf *out, struct bch_fs *c, struct bkey_s_c
prt_printf(out, "gen %u oldest_gen %u data_type ", a->gen, a->oldest_gen); prt_printf(out, "gen %u oldest_gen %u data_type ", a->gen, a->oldest_gen);
bch2_prt_data_type(out, a->data_type); bch2_prt_data_type(out, a->data_type);
prt_newline(out); prt_newline(out);
prt_printf(out, "journal_seq %llu", a->journal_seq); prt_printf(out, "journal_seq %llu\n", a->journal_seq);
prt_newline(out); prt_printf(out, "need_discard %llu\n", BCH_ALLOC_V4_NEED_DISCARD(a));
prt_printf(out, "need_discard %llu", BCH_ALLOC_V4_NEED_DISCARD(a)); prt_printf(out, "need_inc_gen %llu\n", BCH_ALLOC_V4_NEED_INC_GEN(a));
prt_newline(out); prt_printf(out, "dirty_sectors %u\n", a->dirty_sectors);
prt_printf(out, "need_inc_gen %llu", BCH_ALLOC_V4_NEED_INC_GEN(a)); prt_printf(out, "cached_sectors %u\n", a->cached_sectors);
prt_newline(out); prt_printf(out, "stripe %u\n", a->stripe);
prt_printf(out, "dirty_sectors %u", a->dirty_sectors); prt_printf(out, "stripe_redundancy %u\n", a->stripe_redundancy);
prt_newline(out); prt_printf(out, "io_time[READ] %llu\n", a->io_time[READ]);
prt_printf(out, "cached_sectors %u", a->cached_sectors); prt_printf(out, "io_time[WRITE] %llu\n", a->io_time[WRITE]);
prt_newline(out); prt_printf(out, "fragmentation %llu\n", a->fragmentation_lru);
prt_printf(out, "stripe %u", a->stripe); prt_printf(out, "bp_start %llu\n", BCH_ALLOC_V4_BACKPOINTERS_START(a));
prt_newline(out);
prt_printf(out, "stripe_redundancy %u", a->stripe_redundancy);
prt_newline(out);
prt_printf(out, "io_time[READ] %llu", a->io_time[READ]);
prt_newline(out);
prt_printf(out, "io_time[WRITE] %llu", a->io_time[WRITE]);
prt_newline(out);
prt_printf(out, "fragmentation %llu", a->fragmentation_lru);
prt_newline(out);
prt_printf(out, "bp_start %llu", BCH_ALLOC_V4_BACKPOINTERS_START(a));
printbuf_indent_sub(out, 2); printbuf_indent_sub(out, 2);
} }
......
...@@ -117,8 +117,7 @@ static noinline int backpointer_mod_err(struct btree_trans *trans, ...@@ -117,8 +117,7 @@ static noinline int backpointer_mod_err(struct btree_trans *trans,
bch_err(c, "%s", buf.buf); bch_err(c, "%s", buf.buf);
} else if (c->curr_recovery_pass > BCH_RECOVERY_PASS_check_extents_to_backpointers) { } else if (c->curr_recovery_pass > BCH_RECOVERY_PASS_check_extents_to_backpointers) {
prt_printf(&buf, "backpointer not found when deleting"); prt_printf(&buf, "backpointer not found when deleting\n");
prt_newline(&buf);
printbuf_indent_add(&buf, 2); printbuf_indent_add(&buf, 2);
prt_printf(&buf, "searching for "); prt_printf(&buf, "searching for ");
......
...@@ -522,7 +522,9 @@ static void btree_err_msg(struct printbuf *out, struct bch_fs *c, ...@@ -522,7 +522,9 @@ static void btree_err_msg(struct printbuf *out, struct bch_fs *c,
prt_printf(out, "at btree "); prt_printf(out, "at btree ");
bch2_btree_pos_to_text(out, c, b); bch2_btree_pos_to_text(out, c, b);
prt_printf(out, "\n node offset %u/%u", printbuf_indent_add(out, 2);
prt_printf(out, "\nnode offset %u/%u",
b->written, btree_ptr_sectors_written(&b->key)); b->written, btree_ptr_sectors_written(&b->key));
if (i) if (i)
prt_printf(out, " bset u64s %u", le16_to_cpu(i->u64s)); prt_printf(out, " bset u64s %u", le16_to_cpu(i->u64s));
...@@ -2344,20 +2346,13 @@ void bch2_btree_write_stats_to_text(struct printbuf *out, struct bch_fs *c) ...@@ -2344,20 +2346,13 @@ void bch2_btree_write_stats_to_text(struct printbuf *out, struct bch_fs *c)
printbuf_tabstop_push(out, 20); printbuf_tabstop_push(out, 20);
printbuf_tabstop_push(out, 10); printbuf_tabstop_push(out, 10);
prt_tab(out); prt_printf(out, "\tnr\tsize\n");
prt_str(out, "nr");
prt_tab(out);
prt_str(out, "size");
prt_newline(out);
for (unsigned i = 0; i < BTREE_WRITE_TYPE_NR; i++) { for (unsigned i = 0; i < BTREE_WRITE_TYPE_NR; i++) {
u64 nr = atomic64_read(&c->btree_write_stats[i].nr); u64 nr = atomic64_read(&c->btree_write_stats[i].nr);
u64 bytes = atomic64_read(&c->btree_write_stats[i].bytes); u64 bytes = atomic64_read(&c->btree_write_stats[i].bytes);
prt_printf(out, "%s:", bch2_btree_write_types[i]); prt_printf(out, "%s:\t%llu\t", bch2_btree_write_types[i], nr);
prt_tab(out);
prt_u64(out, nr);
prt_tab(out);
prt_human_readable_u64(out, nr ? div64_u64(bytes, nr) : 0); prt_human_readable_u64(out, nr ? div64_u64(bytes, nr) : 0);
prt_newline(out); prt_newline(out);
} }
......
...@@ -1387,19 +1387,17 @@ void __noreturn bch2_trans_in_restart_error(struct btree_trans *trans) ...@@ -1387,19 +1387,17 @@ void __noreturn bch2_trans_in_restart_error(struct btree_trans *trans)
noinline __cold noinline __cold
void bch2_trans_updates_to_text(struct printbuf *buf, struct btree_trans *trans) void bch2_trans_updates_to_text(struct printbuf *buf, struct btree_trans *trans)
{ {
prt_printf(buf, "transaction updates for %s journal seq %llu", prt_printf(buf, "transaction updates for %s journal seq %llu\n",
trans->fn, trans->journal_res.seq); trans->fn, trans->journal_res.seq);
prt_newline(buf);
printbuf_indent_add(buf, 2); printbuf_indent_add(buf, 2);
trans_for_each_update(trans, i) { trans_for_each_update(trans, i) {
struct bkey_s_c old = { &i->old_k, i->old_v }; struct bkey_s_c old = { &i->old_k, i->old_v };
prt_printf(buf, "update: btree=%s cached=%u %pS", prt_printf(buf, "update: btree=%s cached=%u %pS\n",
bch2_btree_id_str(i->btree_id), bch2_btree_id_str(i->btree_id),
i->cached, i->cached,
(void *) i->ip_allocated); (void *) i->ip_allocated);
prt_newline(buf);
prt_printf(buf, " old "); prt_printf(buf, " old ");
bch2_bkey_val_to_text(buf, trans->c, old); bch2_bkey_val_to_text(buf, trans->c, old);
...@@ -3166,13 +3164,11 @@ bch2_btree_bkey_cached_common_to_text(struct printbuf *out, ...@@ -3166,13 +3164,11 @@ bch2_btree_bkey_cached_common_to_text(struct printbuf *out,
pid = owner ? owner->pid : 0; pid = owner ? owner->pid : 0;
rcu_read_unlock(); rcu_read_unlock();
prt_tab(out); prt_printf(out, "\t%px %c l=%u %s:", b, b->cached ? 'c' : 'b',
prt_printf(out, "%px %c l=%u %s:", b, b->cached ? 'c' : 'b',
b->level, bch2_btree_id_str(b->btree_id)); b->level, bch2_btree_id_str(b->btree_id));
bch2_bpos_to_text(out, btree_node_pos(b)); bch2_bpos_to_text(out, btree_node_pos(b));
prt_tab(out); prt_printf(out, "\t locks %u:%u:%u held by pid %u",
prt_printf(out, " locks %u:%u:%u held by pid %u",
c.n[0], c.n[1], c.n[2], pid); c.n[0], c.n[1], c.n[2], pid);
} }
...@@ -3229,10 +3225,8 @@ void bch2_btree_trans_to_text(struct printbuf *out, struct btree_trans *trans) ...@@ -3229,10 +3225,8 @@ void bch2_btree_trans_to_text(struct printbuf *out, struct btree_trans *trans)
b = READ_ONCE(trans->locking); b = READ_ONCE(trans->locking);
if (b) { if (b) {
prt_printf(out, " blocked for %lluus on", prt_printf(out, " blocked for %lluus on\n",
div_u64(local_clock() - trans->locking_wait.start_time, div_u64(local_clock() - trans->locking_wait.start_time, 1000));
1000));
prt_newline(out);
prt_printf(out, " %c", lock_types[trans->locking_wait.lock_want]); prt_printf(out, " %c", lock_types[trans->locking_wait.lock_want]);
bch2_btree_bkey_cached_common_to_text(out, b); bch2_btree_bkey_cached_common_to_text(out, b);
prt_newline(out); prt_newline(out);
......
...@@ -1039,12 +1039,9 @@ int bch2_fs_btree_key_cache_init(struct btree_key_cache *bc) ...@@ -1039,12 +1039,9 @@ int bch2_fs_btree_key_cache_init(struct btree_key_cache *bc)
void bch2_btree_key_cache_to_text(struct printbuf *out, struct btree_key_cache *c) void bch2_btree_key_cache_to_text(struct printbuf *out, struct btree_key_cache *c)
{ {
prt_printf(out, "nr_freed:\t%lu", atomic_long_read(&c->nr_freed)); prt_printf(out, "nr_freed:\t%lu\n", atomic_long_read(&c->nr_freed));
prt_newline(out); prt_printf(out, "nr_keys:\t%lu\n", atomic_long_read(&c->nr_keys));
prt_printf(out, "nr_keys:\t%lu", atomic_long_read(&c->nr_keys)); prt_printf(out, "nr_dirty:\t%lu\n", atomic_long_read(&c->nr_dirty));
prt_newline(out);
prt_printf(out, "nr_dirty:\t%lu", atomic_long_read(&c->nr_dirty));
prt_newline(out);
} }
void bch2_btree_key_cache_exit(void) void bch2_btree_key_cache_exit(void)
......
...@@ -83,8 +83,7 @@ static noinline void print_cycle(struct printbuf *out, struct lock_graph *g) ...@@ -83,8 +83,7 @@ static noinline void print_cycle(struct printbuf *out, struct lock_graph *g)
{ {
struct trans_waiting_for_lock *i; struct trans_waiting_for_lock *i;
prt_printf(out, "Found lock cycle (%u entries):", g->nr); prt_printf(out, "Found lock cycle (%u entries):\n", g->nr);
prt_newline(out);
for (i = g->g; i < g->g + g->nr; i++) { for (i = g->g; i < g->g + g->nr; i++) {
struct task_struct *task = READ_ONCE(i->trans->locking_wait.task); struct task_struct *task = READ_ONCE(i->trans->locking_wait.task);
...@@ -224,8 +223,7 @@ static noinline int break_cycle(struct lock_graph *g, struct printbuf *cycle) ...@@ -224,8 +223,7 @@ static noinline int break_cycle(struct lock_graph *g, struct printbuf *cycle)
bch2_btree_trans_to_text(&buf, trans); bch2_btree_trans_to_text(&buf, trans);
prt_printf(&buf, "backtrace:"); prt_printf(&buf, "backtrace:\n");
prt_newline(&buf);
printbuf_indent_add(&buf, 2); printbuf_indent_add(&buf, 2);
bch2_prt_task_backtrace(&buf, trans->locking_wait.task, 2, GFP_NOWAIT); bch2_prt_task_backtrace(&buf, trans->locking_wait.task, 2, GFP_NOWAIT);
printbuf_indent_sub(&buf, 2); printbuf_indent_sub(&buf, 2);
......
...@@ -773,9 +773,8 @@ static noinline int bch2_trans_commit_bkey_invalid(struct btree_trans *trans, ...@@ -773,9 +773,8 @@ static noinline int bch2_trans_commit_bkey_invalid(struct btree_trans *trans,
struct bch_fs *c = trans->c; struct bch_fs *c = trans->c;
printbuf_reset(err); printbuf_reset(err);
prt_printf(err, "invalid bkey on insert from %s -> %ps", prt_printf(err, "invalid bkey on insert from %s -> %ps\n",
trans->fn, (void *) i->ip_allocated); trans->fn, (void *) i->ip_allocated);
prt_newline(err);
printbuf_indent_add(err, 2); printbuf_indent_add(err, 2);
bch2_bkey_val_to_text(err, c, bkey_i_to_s_c(i->k)); bch2_bkey_val_to_text(err, c, bkey_i_to_s_c(i->k));
...@@ -796,8 +795,7 @@ static noinline int bch2_trans_commit_journal_entry_invalid(struct btree_trans * ...@@ -796,8 +795,7 @@ static noinline int bch2_trans_commit_journal_entry_invalid(struct btree_trans *
struct bch_fs *c = trans->c; struct bch_fs *c = trans->c;
struct printbuf buf = PRINTBUF; struct printbuf buf = PRINTBUF;
prt_printf(&buf, "invalid bkey on insert from %s", trans->fn); prt_printf(&buf, "invalid bkey on insert from %s\n", trans->fn);
prt_newline(&buf);
printbuf_indent_add(&buf, 2); printbuf_indent_add(&buf, 2);
bch2_journal_entry_to_text(&buf, c, i); bch2_journal_entry_to_text(&buf, c, i);
......
...@@ -274,25 +274,14 @@ void bch2_dev_usage_init(struct bch_dev *ca) ...@@ -274,25 +274,14 @@ void bch2_dev_usage_init(struct bch_dev *ca)
void bch2_dev_usage_to_text(struct printbuf *out, struct bch_dev_usage *usage) void bch2_dev_usage_to_text(struct printbuf *out, struct bch_dev_usage *usage)
{ {
prt_tab(out); prt_printf(out, "\tbuckets\rsectors\rfragmented\r\n");
prt_str(out, "buckets");
prt_tab_rjust(out);
prt_str(out, "sectors");
prt_tab_rjust(out);
prt_str(out, "fragmented");
prt_tab_rjust(out);
prt_newline(out);
for (unsigned i = 0; i < BCH_DATA_NR; i++) { for (unsigned i = 0; i < BCH_DATA_NR; i++) {
bch2_prt_data_type(out, i); bch2_prt_data_type(out, i);
prt_tab(out); prt_printf(out, "\t%llu\r%llu\r%llu\r\n",
prt_u64(out, usage->d[i].buckets); usage->d[i].buckets,
prt_tab_rjust(out); usage->d[i].sectors,
prt_u64(out, usage->d[i].sectors); usage->d[i].fragmented);
prt_tab_rjust(out);
prt_u64(out, usage->d[i].fragmented);
prt_tab_rjust(out);
prt_newline(out);
} }
} }
......
...@@ -494,14 +494,10 @@ static void bch2_sb_crypt_to_text(struct printbuf *out, struct bch_sb *sb, ...@@ -494,14 +494,10 @@ static void bch2_sb_crypt_to_text(struct printbuf *out, struct bch_sb *sb,
{ {
struct bch_sb_field_crypt *crypt = field_to_type(f, crypt); struct bch_sb_field_crypt *crypt = field_to_type(f, crypt);
prt_printf(out, "KFD: %llu", BCH_CRYPT_KDF_TYPE(crypt)); prt_printf(out, "KFD: %llu\n", BCH_CRYPT_KDF_TYPE(crypt));
prt_newline(out); prt_printf(out, "scrypt n: %llu\n", BCH_KDF_SCRYPT_N(crypt));
prt_printf(out, "scrypt n: %llu", BCH_KDF_SCRYPT_N(crypt)); prt_printf(out, "scrypt r: %llu\n", BCH_KDF_SCRYPT_R(crypt));
prt_newline(out); prt_printf(out, "scrypt p: %llu\n", BCH_KDF_SCRYPT_P(crypt));
prt_printf(out, "scrypt r: %llu", BCH_KDF_SCRYPT_R(crypt));
prt_newline(out);
prt_printf(out, "scrypt p: %llu", BCH_KDF_SCRYPT_P(crypt));
prt_newline(out);
} }
const struct bch_sb_field_ops bch_sb_field_ops_crypt = { const struct bch_sb_field_ops bch_sb_field_ops_crypt = {
......
...@@ -492,51 +492,26 @@ static void bch2_cached_btree_node_to_text(struct printbuf *out, struct bch_fs * ...@@ -492,51 +492,26 @@ static void bch2_cached_btree_node_to_text(struct printbuf *out, struct bch_fs *
if (!out->nr_tabstops) if (!out->nr_tabstops)
printbuf_tabstop_push(out, 32); printbuf_tabstop_push(out, 32);
prt_printf(out, "%px btree=%s l=%u ", prt_printf(out, "%px btree=%s l=%u\n", b, bch2_btree_id_str(b->c.btree_id), b->c.level);
b,
bch2_btree_id_str(b->c.btree_id),
b->c.level);
prt_newline(out);
printbuf_indent_add(out, 2); printbuf_indent_add(out, 2);
bch2_bkey_val_to_text(out, c, bkey_i_to_s_c(&b->key)); bch2_bkey_val_to_text(out, c, bkey_i_to_s_c(&b->key));
prt_newline(out); prt_newline(out);
prt_printf(out, "flags: "); prt_printf(out, "flags:\t");
prt_tab(out);
prt_bitflags(out, bch2_btree_node_flags, b->flags); prt_bitflags(out, bch2_btree_node_flags, b->flags);
prt_newline(out); prt_newline(out);
prt_printf(out, "pcpu read locks: "); prt_printf(out, "pcpu read locks:\t%u\n", b->c.lock.readers != NULL);
prt_tab(out); prt_printf(out, "written:\t%u\n", b->written);
prt_printf(out, "%u", b->c.lock.readers != NULL); prt_printf(out, "writes blocked:\t%u\n", !list_empty_careful(&b->write_blocked));
prt_newline(out); prt_printf(out, "will make reachable:\t%lx\n", b->will_make_reachable);
prt_printf(out, "written:");
prt_tab(out);
prt_printf(out, "%u", b->written);
prt_newline(out);
prt_printf(out, "writes blocked:");
prt_tab(out);
prt_printf(out, "%u", !list_empty_careful(&b->write_blocked));
prt_newline(out);
prt_printf(out, "will make reachable:");
prt_tab(out);
prt_printf(out, "%lx", b->will_make_reachable);
prt_newline(out);
prt_printf(out, "journal pin %px:", &b->writes[0].journal);
prt_tab(out);
prt_printf(out, "%llu", b->writes[0].journal.seq);
prt_newline(out);
prt_printf(out, "journal pin %px:", &b->writes[1].journal); prt_printf(out, "journal pin %px:\t%llu\n",
prt_tab(out); &b->writes[0].journal, b->writes[0].journal.seq);
prt_printf(out, "%llu", b->writes[1].journal.seq); prt_printf(out, "journal pin %px:\t%llu\n",
prt_newline(out); &b->writes[1].journal, b->writes[1].journal.seq);
printbuf_indent_sub(out, 2); printbuf_indent_sub(out, 2);
} }
...@@ -625,8 +600,7 @@ static ssize_t bch2_btree_transactions_read(struct file *file, char __user *buf, ...@@ -625,8 +600,7 @@ static ssize_t bch2_btree_transactions_read(struct file *file, char __user *buf,
bch2_btree_trans_to_text(&i->buf, trans); bch2_btree_trans_to_text(&i->buf, trans);
prt_printf(&i->buf, "backtrace:"); prt_printf(&i->buf, "backtrace:\n");
prt_newline(&i->buf);
printbuf_indent_add(&i->buf, 2); printbuf_indent_add(&i->buf, 2);
bch2_prt_task_backtrace(&i->buf, task, 0, GFP_KERNEL); bch2_prt_task_backtrace(&i->buf, task, 0, GFP_KERNEL);
printbuf_indent_sub(&i->buf, 2); printbuf_indent_sub(&i->buf, 2);
...@@ -782,25 +756,20 @@ static ssize_t btree_transaction_stats_read(struct file *file, char __user *buf, ...@@ -782,25 +756,20 @@ static ssize_t btree_transaction_stats_read(struct file *file, char __user *buf,
!bch2_btree_transaction_fns[i->iter]) !bch2_btree_transaction_fns[i->iter])
break; break;
prt_printf(&i->buf, "%s: ", bch2_btree_transaction_fns[i->iter]); prt_printf(&i->buf, "%s:\n", bch2_btree_transaction_fns[i->iter]);
prt_newline(&i->buf);
printbuf_indent_add(&i->buf, 2); printbuf_indent_add(&i->buf, 2);
mutex_lock(&s->lock); mutex_lock(&s->lock);
prt_printf(&i->buf, "Max mem used: %u", s->max_mem); prt_printf(&i->buf, "Max mem used: %u\n", s->max_mem);
prt_newline(&i->buf); prt_printf(&i->buf, "Transaction duration:\n");
prt_printf(&i->buf, "Transaction duration:");
prt_newline(&i->buf);
printbuf_indent_add(&i->buf, 2); printbuf_indent_add(&i->buf, 2);
bch2_time_stats_to_text(&i->buf, &s->duration); bch2_time_stats_to_text(&i->buf, &s->duration);
printbuf_indent_sub(&i->buf, 2); printbuf_indent_sub(&i->buf, 2);
if (IS_ENABLED(CONFIG_BCACHEFS_LOCK_TIME_STATS)) { if (IS_ENABLED(CONFIG_BCACHEFS_LOCK_TIME_STATS)) {
prt_printf(&i->buf, "Lock hold times:"); prt_printf(&i->buf, "Lock hold times:\n");
prt_newline(&i->buf);
printbuf_indent_add(&i->buf, 2); printbuf_indent_add(&i->buf, 2);
bch2_time_stats_to_text(&i->buf, &s->lock_hold_times); bch2_time_stats_to_text(&i->buf, &s->lock_hold_times);
...@@ -808,8 +777,7 @@ static ssize_t btree_transaction_stats_read(struct file *file, char __user *buf, ...@@ -808,8 +777,7 @@ static ssize_t btree_transaction_stats_read(struct file *file, char __user *buf,
} }
if (s->max_paths_text) { if (s->max_paths_text) {
prt_printf(&i->buf, "Maximum allocated btree paths (%u):", s->nr_max_paths); prt_printf(&i->buf, "Maximum allocated btree paths (%u):\n", s->nr_max_paths);
prt_newline(&i->buf);
printbuf_indent_add(&i->buf, 2); printbuf_indent_add(&i->buf, 2);
prt_str_indented(&i->buf, s->max_paths_text); prt_str_indented(&i->buf, s->max_paths_text);
......
...@@ -535,29 +535,19 @@ static void __bch2_inode_unpacked_to_text(struct printbuf *out, ...@@ -535,29 +535,19 @@ static void __bch2_inode_unpacked_to_text(struct printbuf *out,
struct bch_inode_unpacked *inode) struct bch_inode_unpacked *inode)
{ {
printbuf_indent_add(out, 2); printbuf_indent_add(out, 2);
prt_printf(out, "mode=%o", inode->bi_mode); prt_printf(out, "mode=%o\n", inode->bi_mode);
prt_newline(out);
prt_str(out, "flags="); prt_str(out, "flags=");
prt_bitflags(out, bch2_inode_flag_strs, inode->bi_flags & ((1U << 20) - 1)); prt_bitflags(out, bch2_inode_flag_strs, inode->bi_flags & ((1U << 20) - 1));
prt_printf(out, " (%x)", inode->bi_flags); prt_printf(out, " (%x)\n", inode->bi_flags);
prt_newline(out);
prt_printf(out, "journal_seq=%llu", inode->bi_journal_seq); prt_printf(out, "journal_seq=%llu\n", inode->bi_journal_seq);
prt_newline(out); prt_printf(out, "bi_size=%llu\n", inode->bi_size);
prt_printf(out, "bi_sectors=%llu\n", inode->bi_sectors);
prt_printf(out, "bi_size=%llu", inode->bi_size); prt_printf(out, "bi_version=%llu\n", inode->bi_version);
prt_newline(out);
prt_printf(out, "bi_sectors=%llu", inode->bi_sectors);
prt_newline(out);
prt_printf(out, "bi_version=%llu", inode->bi_version);
prt_newline(out);
#define x(_name, _bits) \ #define x(_name, _bits) \
prt_printf(out, #_name "=%llu", (u64) inode->_name); \ prt_printf(out, #_name "=%llu\n", (u64) inode->_name);
prt_newline(out);
BCH_INODE_FIELDS_v3() BCH_INODE_FIELDS_v3()
#undef x #undef x
printbuf_indent_sub(out, 2); printbuf_indent_sub(out, 2);
......
...@@ -771,9 +771,8 @@ static noinline void read_from_stale_dirty_pointer(struct btree_trans *trans, ...@@ -771,9 +771,8 @@ static noinline void read_from_stale_dirty_pointer(struct btree_trans *trans,
PTR_BUCKET_POS(c, &ptr), PTR_BUCKET_POS(c, &ptr),
BTREE_ITER_CACHED); BTREE_ITER_CACHED);
prt_printf(&buf, "Attempting to read from stale dirty pointer:"); prt_printf(&buf, "Attempting to read from stale dirty pointer:\n");
printbuf_indent_add(&buf, 2); printbuf_indent_add(&buf, 2);
prt_newline(&buf);
bch2_bkey_val_to_text(&buf, c, k); bch2_bkey_val_to_text(&buf, c, k);
prt_newline(&buf); prt_newline(&buf);
......
...@@ -1649,8 +1649,7 @@ void bch2_write_op_to_text(struct printbuf *out, struct bch_write_op *op) ...@@ -1649,8 +1649,7 @@ void bch2_write_op_to_text(struct printbuf *out, struct bch_write_op *op)
prt_bitflags(out, bch2_write_flags, op->flags); prt_bitflags(out, bch2_write_flags, op->flags);
prt_newline(out); prt_newline(out);
prt_printf(out, "ref: %u", closure_nr_remaining(&op->cl)); prt_printf(out, "ref: %u\n", closure_nr_remaining(&op->cl));
prt_newline(out);
printbuf_indent_sub(out, 2); printbuf_indent_sub(out, 2);
} }
......
...@@ -53,29 +53,19 @@ static void bch2_journal_buf_to_text(struct printbuf *out, struct journal *j, u6 ...@@ -53,29 +53,19 @@ static void bch2_journal_buf_to_text(struct printbuf *out, struct journal *j, u6
unsigned i = seq & JOURNAL_BUF_MASK; unsigned i = seq & JOURNAL_BUF_MASK;
struct journal_buf *buf = j->buf + i; struct journal_buf *buf = j->buf + i;
prt_str(out, "seq:"); prt_printf(out, "seq:\t%llu\n", seq);
prt_tab(out);
prt_printf(out, "%llu", seq);
prt_newline(out);
printbuf_indent_add(out, 2); printbuf_indent_add(out, 2);
prt_str(out, "refcount:"); prt_printf(out, "refcount:\t%u\n", journal_state_count(s, i));
prt_tab(out);
prt_printf(out, "%u", journal_state_count(s, i));
prt_newline(out);
prt_str(out, "size:"); prt_printf(out, "size:\t");
prt_tab(out);
prt_human_readable_u64(out, vstruct_bytes(buf->data)); prt_human_readable_u64(out, vstruct_bytes(buf->data));
prt_newline(out); prt_newline(out);
prt_str(out, "expires:"); prt_printf(out, "expires:\t");
prt_tab(out); prt_printf(out, "%li jiffies\n", buf->expires - jiffies);
prt_printf(out, "%li jiffies", buf->expires - jiffies);
prt_newline(out);
prt_str(out, "flags:"); prt_printf(out, "flags:\t");
prt_tab(out);
if (buf->noflush) if (buf->noflush)
prt_str(out, "noflush "); prt_str(out, "noflush ");
if (buf->must_flush) if (buf->must_flush)
...@@ -1422,12 +1412,12 @@ void __bch2_journal_debug_to_text(struct printbuf *out, struct journal *j) ...@@ -1422,12 +1412,12 @@ void __bch2_journal_debug_to_text(struct printbuf *out, struct journal *j)
s = READ_ONCE(j->reservations); s = READ_ONCE(j->reservations);
prt_printf(out, "dirty journal entries:\t%llu/%llu\n", fifo_used(&j->pin), j->pin.size); prt_printf(out, "dirty journal entries:\t%llu/%llu\n", fifo_used(&j->pin), j->pin.size);
prt_printf(out, "seq:\t\t\t%llu\n", journal_cur_seq(j)); prt_printf(out, "seq:\t%llu\n", journal_cur_seq(j));
prt_printf(out, "seq_ondisk:\t\t%llu\n", j->seq_ondisk); prt_printf(out, "seq_ondisk:\t%llu\n", j->seq_ondisk);
prt_printf(out, "last_seq:\t\t%llu\n", journal_last_seq(j)); prt_printf(out, "last_seq:\t%llu\n", journal_last_seq(j));
prt_printf(out, "last_seq_ondisk:\t%llu\n", j->last_seq_ondisk); prt_printf(out, "last_seq_ondisk:\t%llu\n", j->last_seq_ondisk);
prt_printf(out, "flushed_seq_ondisk:\t%llu\n", j->flushed_seq_ondisk); prt_printf(out, "flushed_seq_ondisk:\t%llu\n", j->flushed_seq_ondisk);
prt_printf(out, "watermark:\t\t%s\n", bch2_watermarks[j->watermark]); prt_printf(out, "watermark:\t%s\n", bch2_watermarks[j->watermark]);
prt_printf(out, "each entry reserved:\t%u\n", j->entry_u64s_reserved); prt_printf(out, "each entry reserved:\t%u\n", j->entry_u64s_reserved);
prt_printf(out, "nr flush writes:\t%llu\n", j->nr_flush_writes); prt_printf(out, "nr flush writes:\t%llu\n", j->nr_flush_writes);
prt_printf(out, "nr noflush writes:\t%llu\n", j->nr_noflush_writes); prt_printf(out, "nr noflush writes:\t%llu\n", j->nr_noflush_writes);
...@@ -1436,48 +1426,48 @@ void __bch2_journal_debug_to_text(struct printbuf *out, struct journal *j) ...@@ -1436,48 +1426,48 @@ void __bch2_journal_debug_to_text(struct printbuf *out, struct journal *j)
prt_newline(out); prt_newline(out);
prt_printf(out, "nr direct reclaim:\t%llu\n", j->nr_direct_reclaim); prt_printf(out, "nr direct reclaim:\t%llu\n", j->nr_direct_reclaim);
prt_printf(out, "nr background reclaim:\t%llu\n", j->nr_background_reclaim); prt_printf(out, "nr background reclaim:\t%llu\n", j->nr_background_reclaim);
prt_printf(out, "reclaim kicked:\t\t%u\n", j->reclaim_kicked); prt_printf(out, "reclaim kicked:\t%u\n", j->reclaim_kicked);
prt_printf(out, "reclaim runs in:\t%u ms\n", time_after(j->next_reclaim, now) prt_printf(out, "reclaim runs in:\t%u ms\n", time_after(j->next_reclaim, now)
? jiffies_to_msecs(j->next_reclaim - jiffies) : 0); ? jiffies_to_msecs(j->next_reclaim - jiffies) : 0);
prt_printf(out, "blocked:\t\t%u\n", j->blocked); prt_printf(out, "blocked:\t%u\n", j->blocked);
prt_printf(out, "current entry sectors:\t%u\n", j->cur_entry_sectors); prt_printf(out, "current entry sectors:\t%u\n", j->cur_entry_sectors);
prt_printf(out, "current entry error:\t%s\n", bch2_journal_errors[j->cur_entry_error]); prt_printf(out, "current entry error:\t%s\n", bch2_journal_errors[j->cur_entry_error]);
prt_printf(out, "current entry:\t\t"); prt_printf(out, "current entry:\t");
switch (s.cur_entry_offset) { switch (s.cur_entry_offset) {
case JOURNAL_ENTRY_ERROR_VAL: case JOURNAL_ENTRY_ERROR_VAL:
prt_printf(out, "error"); prt_printf(out, "error\n");
break; break;
case JOURNAL_ENTRY_CLOSED_VAL: case JOURNAL_ENTRY_CLOSED_VAL:
prt_printf(out, "closed"); prt_printf(out, "closed\n");
break; break;
default: default:
prt_printf(out, "%u/%u", s.cur_entry_offset, j->cur_entry_u64s); prt_printf(out, "%u/%u\n", s.cur_entry_offset, j->cur_entry_u64s);
break; break;
} }
prt_newline(out); prt_printf(out, "unwritten entries:\n");
prt_printf(out, "unwritten entries:");
prt_newline(out);
bch2_journal_bufs_to_text(out, j); bch2_journal_bufs_to_text(out, j);
prt_printf(out, prt_printf(out,
"replay done:\t\t%i\n", "replay done:\t%i\n",
test_bit(JOURNAL_REPLAY_DONE, &j->flags)); test_bit(JOURNAL_REPLAY_DONE, &j->flags));
prt_printf(out, "space:\n"); prt_printf(out, "space:\n");
prt_printf(out, "\tdiscarded\t%u:%u\n", printbuf_indent_add(out, 2);
prt_printf(out, "discarded\t%u:%u\n",
j->space[journal_space_discarded].next_entry, j->space[journal_space_discarded].next_entry,
j->space[journal_space_discarded].total); j->space[journal_space_discarded].total);
prt_printf(out, "\tclean ondisk\t%u:%u\n", prt_printf(out, "clean ondisk\t%u:%u\n",
j->space[journal_space_clean_ondisk].next_entry, j->space[journal_space_clean_ondisk].next_entry,
j->space[journal_space_clean_ondisk].total); j->space[journal_space_clean_ondisk].total);
prt_printf(out, "\tclean\t\t%u:%u\n", prt_printf(out, "clean\t%u:%u\n",
j->space[journal_space_clean].next_entry, j->space[journal_space_clean].next_entry,
j->space[journal_space_clean].total); j->space[journal_space_clean].total);
prt_printf(out, "\ttotal\t\t%u:%u\n", prt_printf(out, "total\t%u:%u\n",
j->space[journal_space_total].next_entry, j->space[journal_space_total].next_entry,
j->space[journal_space_total].total); j->space[journal_space_total].total);
printbuf_indent_sub(out, 2);
for_each_member_device_rcu(c, ca, &c->rw_devs[BCH_DATA_journal]) { for_each_member_device_rcu(c, ca, &c->rw_devs[BCH_DATA_journal]) {
struct journal_device *ja = &ca->journal; struct journal_device *ja = &ca->journal;
...@@ -1488,14 +1478,16 @@ void __bch2_journal_debug_to_text(struct printbuf *out, struct journal *j) ...@@ -1488,14 +1478,16 @@ void __bch2_journal_debug_to_text(struct printbuf *out, struct journal *j)
if (!ja->nr) if (!ja->nr)
continue; continue;
prt_printf(out, "dev %u:\n", ca->dev_idx); prt_printf(out, "dev %u:\n", ca->dev_idx);
prt_printf(out, "\tnr\t\t%u\n", ja->nr); printbuf_indent_add(out, 2);
prt_printf(out, "\tbucket size\t%u\n", ca->mi.bucket_size); prt_printf(out, "nr\t%u\n", ja->nr);
prt_printf(out, "\tavailable\t%u:%u\n", bch2_journal_dev_buckets_available(j, ja, journal_space_discarded), ja->sectors_free); prt_printf(out, "bucket size\t%u\n", ca->mi.bucket_size);
prt_printf(out, "\tdiscard_idx\t%u\n", ja->discard_idx); prt_printf(out, "available\t%u:%u\n", bch2_journal_dev_buckets_available(j, ja, journal_space_discarded), ja->sectors_free);
prt_printf(out, "\tdirty_ondisk\t%u (seq %llu)\n", ja->dirty_idx_ondisk, ja->bucket_seq[ja->dirty_idx_ondisk]); prt_printf(out, "discard_idx\t%u\n", ja->discard_idx);
prt_printf(out, "\tdirty_idx\t%u (seq %llu)\n", ja->dirty_idx, ja->bucket_seq[ja->dirty_idx]); prt_printf(out, "dirty_ondisk\t%u (seq %llu)\n",ja->dirty_idx_ondisk, ja->bucket_seq[ja->dirty_idx_ondisk]);
prt_printf(out, "\tcur_idx\t\t%u (seq %llu)\n", ja->cur_idx, ja->bucket_seq[ja->cur_idx]); prt_printf(out, "dirty_idx\t%u (seq %llu)\n", ja->dirty_idx, ja->bucket_seq[ja->dirty_idx]);
prt_printf(out, "cur_idx\t%u (seq %llu)\n", ja->cur_idx, ja->bucket_seq[ja->cur_idx]);
printbuf_indent_sub(out, 2);
} }
rcu_read_unlock(); rcu_read_unlock();
...@@ -1527,25 +1519,18 @@ bool bch2_journal_seq_pins_to_text(struct printbuf *out, struct journal *j, u64 ...@@ -1527,25 +1519,18 @@ bool bch2_journal_seq_pins_to_text(struct printbuf *out, struct journal *j, u64
pin_list = journal_seq_pin(j, *seq); pin_list = journal_seq_pin(j, *seq);
prt_printf(out, "%llu: count %u", *seq, atomic_read(&pin_list->count)); prt_printf(out, "%llu: count %u\n", *seq, atomic_read(&pin_list->count));
prt_newline(out);
printbuf_indent_add(out, 2); printbuf_indent_add(out, 2);
for (unsigned i = 0; i < ARRAY_SIZE(pin_list->list); i++) for (unsigned i = 0; i < ARRAY_SIZE(pin_list->list); i++)
list_for_each_entry(pin, &pin_list->list[i], list) { list_for_each_entry(pin, &pin_list->list[i], list)
prt_printf(out, "\t%px %ps", pin, pin->flush); prt_printf(out, "\t%px %ps\n", pin, pin->flush);
prt_newline(out);
}
if (!list_empty(&pin_list->flushed)) { if (!list_empty(&pin_list->flushed))
prt_printf(out, "flushed:"); prt_printf(out, "flushed:\n");
prt_newline(out);
}
list_for_each_entry(pin, &pin_list->flushed, list) { list_for_each_entry(pin, &pin_list->flushed, list)
prt_printf(out, "\t%px %ps", pin, pin->flush); prt_printf(out, "\t%px %ps\n", pin, pin->flush);
prt_newline(out);
}
printbuf_indent_sub(out, 2); printbuf_indent_sub(out, 2);
......
...@@ -41,28 +41,23 @@ static void bch2_data_update_opts_to_text(struct printbuf *out, struct bch_fs *c ...@@ -41,28 +41,23 @@ static void bch2_data_update_opts_to_text(struct printbuf *out, struct bch_fs *c
struct data_update_opts *data_opts) struct data_update_opts *data_opts)
{ {
printbuf_tabstop_push(out, 20); printbuf_tabstop_push(out, 20);
prt_str(out, "rewrite ptrs:"); prt_str(out, "rewrite ptrs:\t");
prt_tab(out);
bch2_prt_u64_base2(out, data_opts->rewrite_ptrs); bch2_prt_u64_base2(out, data_opts->rewrite_ptrs);
prt_newline(out); prt_newline(out);
prt_str(out, "kill ptrs: "); prt_str(out, "kill ptrs:\t");
prt_tab(out);
bch2_prt_u64_base2(out, data_opts->kill_ptrs); bch2_prt_u64_base2(out, data_opts->kill_ptrs);
prt_newline(out); prt_newline(out);
prt_str(out, "target: "); prt_str(out, "target:\t");
prt_tab(out);
bch2_target_to_text(out, c, data_opts->target); bch2_target_to_text(out, c, data_opts->target);
prt_newline(out); prt_newline(out);
prt_str(out, "compression: "); prt_str(out, "compression:\t");
prt_tab(out);
bch2_compression_opt_to_text(out, background_compression(*io_opts)); bch2_compression_opt_to_text(out, background_compression(*io_opts));
prt_newline(out); prt_newline(out);
prt_str(out, "extra replicas: "); prt_str(out, "extra replicas:\t");
prt_tab(out);
prt_u64(out, data_opts->extra_replicas); prt_u64(out, data_opts->extra_replicas);
} }
...@@ -1127,23 +1122,17 @@ void bch2_move_stats_to_text(struct printbuf *out, struct bch_move_stats *stats) ...@@ -1127,23 +1122,17 @@ void bch2_move_stats_to_text(struct printbuf *out, struct bch_move_stats *stats)
prt_newline(out); prt_newline(out);
printbuf_indent_add(out, 2); printbuf_indent_add(out, 2);
prt_str(out, "keys moved: "); prt_printf(out, "keys moved: %llu\n", atomic64_read(&stats->keys_moved));
prt_u64(out, atomic64_read(&stats->keys_moved)); prt_printf(out, "keys raced: %llu\n", atomic64_read(&stats->keys_raced));
prt_newline(out); prt_printf(out, "bytes seen: ");
prt_str(out, "keys raced: ");
prt_u64(out, atomic64_read(&stats->keys_raced));
prt_newline(out);
prt_str(out, "bytes seen: ");
prt_human_readable_u64(out, atomic64_read(&stats->sectors_seen) << 9); prt_human_readable_u64(out, atomic64_read(&stats->sectors_seen) << 9);
prt_newline(out); prt_newline(out);
prt_str(out, "bytes moved: "); prt_printf(out, "bytes moved: ");
prt_human_readable_u64(out, atomic64_read(&stats->sectors_moved) << 9); prt_human_readable_u64(out, atomic64_read(&stats->sectors_moved) << 9);
prt_newline(out); prt_newline(out);
prt_str(out, "bytes raced: "); prt_printf(out, "bytes raced: ");
prt_human_readable_u64(out, atomic64_read(&stats->sectors_raced) << 9); prt_human_readable_u64(out, atomic64_read(&stats->sectors_raced) << 9);
prt_newline(out); prt_newline(out);
...@@ -1157,19 +1146,17 @@ static void bch2_moving_ctxt_to_text(struct printbuf *out, struct bch_fs *c, str ...@@ -1157,19 +1146,17 @@ static void bch2_moving_ctxt_to_text(struct printbuf *out, struct bch_fs *c, str
bch2_move_stats_to_text(out, ctxt->stats); bch2_move_stats_to_text(out, ctxt->stats);
printbuf_indent_add(out, 2); printbuf_indent_add(out, 2);
prt_printf(out, "reads: ios %u/%u sectors %u/%u", prt_printf(out, "reads: ios %u/%u sectors %u/%u\n",
atomic_read(&ctxt->read_ios), atomic_read(&ctxt->read_ios),
c->opts.move_ios_in_flight, c->opts.move_ios_in_flight,
atomic_read(&ctxt->read_sectors), atomic_read(&ctxt->read_sectors),
c->opts.move_bytes_in_flight >> 9); c->opts.move_bytes_in_flight >> 9);
prt_newline(out);
prt_printf(out, "writes: ios %u/%u sectors %u/%u", prt_printf(out, "writes: ios %u/%u sectors %u/%u\n",
atomic_read(&ctxt->write_ios), atomic_read(&ctxt->write_ios),
c->opts.move_ios_in_flight, c->opts.move_ios_in_flight,
atomic_read(&ctxt->write_sectors), atomic_read(&ctxt->write_sectors),
c->opts.move_bytes_in_flight >> 9); c->opts.move_bytes_in_flight >> 9);
prt_newline(out);
printbuf_indent_add(out, 2); printbuf_indent_add(out, 2);
......
...@@ -97,45 +97,14 @@ static void qc_info_to_text(struct printbuf *out, struct qc_info *i) ...@@ -97,45 +97,14 @@ static void qc_info_to_text(struct printbuf *out, struct qc_info *i)
printbuf_tabstops_reset(out); printbuf_tabstops_reset(out);
printbuf_tabstop_push(out, 20); printbuf_tabstop_push(out, 20);
prt_str(out, "i_fieldmask"); prt_printf(out, "i_fieldmask\t%x\n", i->i_fieldmask);
prt_tab(out); prt_printf(out, "i_flags\t%u\n", i->i_flags);
prt_printf(out, "%x", i->i_fieldmask); prt_printf(out, "i_spc_timelimit\t%u\n", i->i_spc_timelimit);
prt_newline(out); prt_printf(out, "i_ino_timelimit\t%u\n", i->i_ino_timelimit);
prt_printf(out, "i_rt_spc_timelimit\t%u\n", i->i_rt_spc_timelimit);
prt_str(out, "i_flags"); prt_printf(out, "i_spc_warnlimit\t%u\n", i->i_spc_warnlimit);
prt_tab(out); prt_printf(out, "i_ino_warnlimit\t%u\n", i->i_ino_warnlimit);
prt_printf(out, "%u", i->i_flags); prt_printf(out, "i_rt_spc_warnlimit\t%u\n", i->i_rt_spc_warnlimit);
prt_newline(out);
prt_str(out, "i_spc_timelimit");
prt_tab(out);
prt_printf(out, "%u", i->i_spc_timelimit);
prt_newline(out);
prt_str(out, "i_ino_timelimit");
prt_tab(out);
prt_printf(out, "%u", i->i_ino_timelimit);
prt_newline(out);
prt_str(out, "i_rt_spc_timelimit");
prt_tab(out);
prt_printf(out, "%u", i->i_rt_spc_timelimit);
prt_newline(out);
prt_str(out, "i_spc_warnlimit");
prt_tab(out);
prt_printf(out, "%u", i->i_spc_warnlimit);
prt_newline(out);
prt_str(out, "i_ino_warnlimit");
prt_tab(out);
prt_printf(out, "%u", i->i_ino_warnlimit);
prt_newline(out);
prt_str(out, "i_rt_spc_warnlimit");
prt_tab(out);
prt_printf(out, "%u", i->i_rt_spc_warnlimit);
prt_newline(out);
} }
static void qc_dqblk_to_text(struct printbuf *out, struct qc_dqblk *q) static void qc_dqblk_to_text(struct printbuf *out, struct qc_dqblk *q)
...@@ -143,60 +112,17 @@ static void qc_dqblk_to_text(struct printbuf *out, struct qc_dqblk *q) ...@@ -143,60 +112,17 @@ static void qc_dqblk_to_text(struct printbuf *out, struct qc_dqblk *q)
printbuf_tabstops_reset(out); printbuf_tabstops_reset(out);
printbuf_tabstop_push(out, 20); printbuf_tabstop_push(out, 20);
prt_str(out, "d_fieldmask"); prt_printf(out, "d_fieldmask\t%x\n", q->d_fieldmask);
prt_tab(out); prt_printf(out, "d_spc_hardlimit\t%llu\n", q->d_spc_hardlimit);
prt_printf(out, "%x", q->d_fieldmask); prt_printf(out, "d_spc_softlimit\t%llu\n", q->d_spc_softlimit);
prt_newline(out); prt_printf(out, "d_ino_hardlimit\%llu\n", q->d_ino_hardlimit);
prt_printf(out, "d_ino_softlimit\t%llu\n", q->d_ino_softlimit);
prt_str(out, "d_spc_hardlimit"); prt_printf(out, "d_space\t%llu\n", q->d_space);
prt_tab(out); prt_printf(out, "d_ino_count\t%llu\n", q->d_ino_count);
prt_printf(out, "%llu", q->d_spc_hardlimit); prt_printf(out, "d_ino_timer\t%llu\n", q->d_ino_timer);
prt_newline(out); prt_printf(out, "d_spc_timer\t%llu\n", q->d_spc_timer);
prt_printf(out, "d_ino_warns\t%i\n", q->d_ino_warns);
prt_str(out, "d_spc_softlimit"); prt_printf(out, "d_spc_warns\t%i\n", q->d_spc_warns);
prt_tab(out);
prt_printf(out, "%llu", q->d_spc_softlimit);
prt_newline(out);
prt_str(out, "d_ino_hardlimit");
prt_tab(out);
prt_printf(out, "%llu", q->d_ino_hardlimit);
prt_newline(out);
prt_str(out, "d_ino_softlimit");
prt_tab(out);
prt_printf(out, "%llu", q->d_ino_softlimit);
prt_newline(out);
prt_str(out, "d_space");
prt_tab(out);
prt_printf(out, "%llu", q->d_space);
prt_newline(out);
prt_str(out, "d_ino_count");
prt_tab(out);
prt_printf(out, "%llu", q->d_ino_count);
prt_newline(out);
prt_str(out, "d_ino_timer");
prt_tab(out);
prt_printf(out, "%llu", q->d_ino_timer);
prt_newline(out);
prt_str(out, "d_spc_timer");
prt_tab(out);
prt_printf(out, "%llu", q->d_spc_timer);
prt_newline(out);
prt_str(out, "d_ino_warns");
prt_tab(out);
prt_printf(out, "%i", q->d_ino_warns);
prt_newline(out);
prt_str(out, "d_spc_warns");
prt_tab(out);
prt_printf(out, "%i", q->d_spc_warns);
prt_newline(out);
} }
static inline unsigned __next_qtype(unsigned i, unsigned qtypes) static inline unsigned __next_qtype(unsigned i, unsigned qtypes)
......
...@@ -298,10 +298,8 @@ static void bch2_sb_clean_to_text(struct printbuf *out, struct bch_sb *sb, ...@@ -298,10 +298,8 @@ static void bch2_sb_clean_to_text(struct printbuf *out, struct bch_sb *sb,
struct bch_sb_field_clean *clean = field_to_type(f, clean); struct bch_sb_field_clean *clean = field_to_type(f, clean);
struct jset_entry *entry; struct jset_entry *entry;
prt_printf(out, "flags: %x", le32_to_cpu(clean->flags)); prt_printf(out, "flags: %x\n", le32_to_cpu(clean->flags));
prt_newline(out); prt_printf(out, "journal_seq: %llu\n", le64_to_cpu(clean->journal_seq));
prt_printf(out, "journal_seq: %llu", le64_to_cpu(clean->journal_seq));
prt_newline(out);
for (entry = clean->start; for (entry = clean->start;
entry != vstruct_end(&clean->field); entry != vstruct_end(&clean->field);
......
...@@ -31,19 +31,12 @@ static void bch2_sb_counters_to_text(struct printbuf *out, struct bch_sb *sb, ...@@ -31,19 +31,12 @@ static void bch2_sb_counters_to_text(struct printbuf *out, struct bch_sb *sb,
struct bch_sb_field *f) struct bch_sb_field *f)
{ {
struct bch_sb_field_counters *ctrs = field_to_type(f, counters); struct bch_sb_field_counters *ctrs = field_to_type(f, counters);
unsigned int i;
unsigned int nr = bch2_sb_counter_nr_entries(ctrs); unsigned int nr = bch2_sb_counter_nr_entries(ctrs);
for (i = 0; i < nr; i++) { for (unsigned i = 0; i < nr; i++)
if (i < BCH_COUNTER_NR) prt_printf(out, "%s \t%llu\n",
prt_printf(out, "%s ", bch2_counter_names[i]); i < BCH_COUNTER_NR ? bch2_counter_names[i] : "(unknown)",
else le64_to_cpu(ctrs->d[i]));
prt_printf(out, "(unknown)");
prt_tab(out);
prt_printf(out, "%llu", le64_to_cpu(ctrs->d[i]));
prt_newline(out);
}
}; };
int bch2_sb_counters_to_cpu(struct bch_fs *c) int bch2_sb_counters_to_cpu(struct bch_fs *c)
......
...@@ -164,19 +164,16 @@ static void bch2_sb_downgrade_to_text(struct printbuf *out, struct bch_sb *sb, ...@@ -164,19 +164,16 @@ static void bch2_sb_downgrade_to_text(struct printbuf *out, struct bch_sb *sb,
printbuf_tabstop_push(out, 16); printbuf_tabstop_push(out, 16);
for_each_downgrade_entry(e, i) { for_each_downgrade_entry(e, i) {
prt_str(out, "version:"); prt_str(out, "version:\t");
prt_tab(out);
bch2_version_to_text(out, le16_to_cpu(i->version)); bch2_version_to_text(out, le16_to_cpu(i->version));
prt_newline(out); prt_newline(out);
prt_str(out, "recovery passes:"); prt_str(out, "recovery passes:\t");
prt_tab(out);
prt_bitflags(out, bch2_recovery_passes, prt_bitflags(out, bch2_recovery_passes,
bch2_recovery_passes_from_stable(le64_to_cpu(i->recovery_passes[0]))); bch2_recovery_passes_from_stable(le64_to_cpu(i->recovery_passes[0])));
prt_newline(out); prt_newline(out);
prt_str(out, "errors:"); prt_str(out, "errors:\t");
prt_tab(out);
bool first = true; bool first = true;
for (unsigned j = 0; j < le16_to_cpu(i->nr_errors); j++) { for (unsigned j = 0; j < le16_to_cpu(i->nr_errors); j++) {
if (!first) if (!first)
......
...@@ -167,15 +167,11 @@ static void member_to_text(struct printbuf *out, ...@@ -167,15 +167,11 @@ static void member_to_text(struct printbuf *out,
if (!bch2_member_exists(&m)) if (!bch2_member_exists(&m))
return; return;
prt_printf(out, "Device:"); prt_printf(out, "Device:\t%u\n", i);
prt_tab(out);
prt_printf(out, "%u", i);
prt_newline(out);
printbuf_indent_add(out, 2); printbuf_indent_add(out, 2);
prt_printf(out, "Label:"); prt_printf(out, "Label:\t");
prt_tab(out);
if (BCH_MEMBER_GROUP(&m)) { if (BCH_MEMBER_GROUP(&m)) {
unsigned idx = BCH_MEMBER_GROUP(&m) - 1; unsigned idx = BCH_MEMBER_GROUP(&m) - 1;
...@@ -189,96 +185,59 @@ static void member_to_text(struct printbuf *out, ...@@ -189,96 +185,59 @@ static void member_to_text(struct printbuf *out,
} }
prt_newline(out); prt_newline(out);
prt_printf(out, "UUID:"); prt_printf(out, "UUID:\t");
prt_tab(out);
pr_uuid(out, m.uuid.b); pr_uuid(out, m.uuid.b);
prt_newline(out); prt_newline(out);
prt_printf(out, "Size:"); prt_printf(out, "Size:\t");
prt_tab(out);
prt_units_u64(out, device_size << 9); prt_units_u64(out, device_size << 9);
prt_newline(out); prt_newline(out);
for (unsigned i = 0; i < BCH_MEMBER_ERROR_NR; i++) { for (unsigned i = 0; i < BCH_MEMBER_ERROR_NR; i++)
prt_printf(out, "%s errors:", bch2_member_error_strs[i]); prt_printf(out, "%s errors:\t%llu\n", bch2_member_error_strs[i], le64_to_cpu(m.errors[i]));
prt_tab(out);
prt_u64(out, le64_to_cpu(m.errors[i]));
prt_newline(out);
}
for (unsigned i = 0; i < BCH_IOPS_NR; i++) { for (unsigned i = 0; i < BCH_IOPS_NR; i++)
prt_printf(out, "%s iops:", bch2_iops_measurements[i]); prt_printf(out, "%s iops:\t%u\n", bch2_iops_measurements[i], le32_to_cpu(m.iops[i]));
prt_tab(out);
prt_printf(out, "%u", le32_to_cpu(m.iops[i]));
prt_newline(out);
}
prt_printf(out, "Bucket size:"); prt_printf(out, "Bucket size:\t");
prt_tab(out);
prt_units_u64(out, bucket_size << 9); prt_units_u64(out, bucket_size << 9);
prt_newline(out); prt_newline(out);
prt_printf(out, "First bucket:"); prt_printf(out, "First bucket:\t%u\n", le16_to_cpu(m.first_bucket));
prt_tab(out); prt_printf(out, "Buckets:\t%llu\n", le64_to_cpu(m.nbuckets));
prt_printf(out, "%u", le16_to_cpu(m.first_bucket));
prt_newline(out);
prt_printf(out, "Buckets:"); prt_printf(out, "Last mount:\t");
prt_tab(out);
prt_printf(out, "%llu", le64_to_cpu(m.nbuckets));
prt_newline(out);
prt_printf(out, "Last mount:");
prt_tab(out);
if (m.last_mount) if (m.last_mount)
bch2_prt_datetime(out, le64_to_cpu(m.last_mount)); bch2_prt_datetime(out, le64_to_cpu(m.last_mount));
else else
prt_printf(out, "(never)"); prt_printf(out, "(never)");
prt_newline(out); prt_newline(out);
prt_printf(out, "Last superblock write:"); prt_printf(out, "Last superblock write:\t%llu\n", le64_to_cpu(m.seq));
prt_tab(out);
prt_u64(out, le64_to_cpu(m.seq));
prt_newline(out);
prt_printf(out, "State:"); prt_printf(out, "State:\t%s\n",
prt_tab(out);
prt_printf(out, "%s",
BCH_MEMBER_STATE(&m) < BCH_MEMBER_STATE_NR BCH_MEMBER_STATE(&m) < BCH_MEMBER_STATE_NR
? bch2_member_states[BCH_MEMBER_STATE(&m)] ? bch2_member_states[BCH_MEMBER_STATE(&m)]
: "unknown"); : "unknown");
prt_newline(out);
prt_printf(out, "Data allowed:"); prt_printf(out, "Data allowed:\t");
prt_tab(out);
if (BCH_MEMBER_DATA_ALLOWED(&m)) if (BCH_MEMBER_DATA_ALLOWED(&m))
prt_bitflags(out, __bch2_data_types, BCH_MEMBER_DATA_ALLOWED(&m)); prt_bitflags(out, __bch2_data_types, BCH_MEMBER_DATA_ALLOWED(&m));
else else
prt_printf(out, "(none)"); prt_printf(out, "(none)");
prt_newline(out); prt_newline(out);
prt_printf(out, "Has data:"); prt_printf(out, "Has data:\t");
prt_tab(out);
if (data_have) if (data_have)
prt_bitflags(out, __bch2_data_types, data_have); prt_bitflags(out, __bch2_data_types, data_have);
else else
prt_printf(out, "(none)"); prt_printf(out, "(none)");
prt_newline(out); prt_newline(out);
prt_str(out, "Durability:"); prt_printf(out, "Durability:\t%llu\n", BCH_MEMBER_DURABILITY(&m) ? BCH_MEMBER_DURABILITY(&m) - 1 : 1);
prt_tab(out);
prt_printf(out, "%llu", BCH_MEMBER_DURABILITY(&m) ? BCH_MEMBER_DURABILITY(&m) - 1 : 1);
prt_newline(out);
prt_printf(out, "Discard:"); prt_printf(out, "Discard:\t%llu\n", BCH_MEMBER_DISCARD(&m));
prt_tab(out); prt_printf(out, "Freespace initialized:\t%llu\n", BCH_MEMBER_FREESPACE_INITIALIZED(&m));
prt_printf(out, "%llu", BCH_MEMBER_DISCARD(&m));
prt_newline(out);
prt_printf(out, "Freespace initialized:");
prt_tab(out);
prt_printf(out, "%llu", BCH_MEMBER_FREESPACE_INITIALIZED(&m));
prt_newline(out);
printbuf_indent_sub(out, 2); printbuf_indent_sub(out, 2);
} }
...@@ -390,12 +349,8 @@ void bch2_dev_io_errors_to_text(struct printbuf *out, struct bch_dev *ca) ...@@ -390,12 +349,8 @@ void bch2_dev_io_errors_to_text(struct printbuf *out, struct bch_dev *ca)
prt_newline(out); prt_newline(out);
printbuf_indent_add(out, 2); printbuf_indent_add(out, 2);
for (unsigned i = 0; i < BCH_MEMBER_ERROR_NR; i++) { for (unsigned i = 0; i < BCH_MEMBER_ERROR_NR; i++)
prt_printf(out, "%s:", bch2_member_error_strs[i]); prt_printf(out, "%s:\t%llu\n", bch2_member_error_strs[i], atomic64_read(&ca->errors[i]));
prt_tab(out);
prt_u64(out, atomic64_read(&ca->errors[i]));
prt_newline(out);
}
printbuf_indent_sub(out, 2); printbuf_indent_sub(out, 2);
prt_str(out, "IO errors since "); prt_str(out, "IO errors since ");
...@@ -404,12 +359,9 @@ void bch2_dev_io_errors_to_text(struct printbuf *out, struct bch_dev *ca) ...@@ -404,12 +359,9 @@ void bch2_dev_io_errors_to_text(struct printbuf *out, struct bch_dev *ca)
prt_newline(out); prt_newline(out);
printbuf_indent_add(out, 2); printbuf_indent_add(out, 2);
for (unsigned i = 0; i < BCH_MEMBER_ERROR_NR; i++) { for (unsigned i = 0; i < BCH_MEMBER_ERROR_NR; i++)
prt_printf(out, "%s:", bch2_member_error_strs[i]); prt_printf(out, "%s:\t%llu\n", bch2_member_error_strs[i],
prt_tab(out); atomic64_read(&ca->errors[i]) - le64_to_cpu(m.errors_at_reset[i]));
prt_u64(out, atomic64_read(&ca->errors[i]) - le64_to_cpu(m.errors_at_reset[i]));
prt_newline(out);
}
printbuf_indent_sub(out, 2); printbuf_indent_sub(out, 2);
} }
......
...@@ -1176,8 +1176,7 @@ static void bch2_sb_ext_to_text(struct printbuf *out, struct bch_sb *sb, ...@@ -1176,8 +1176,7 @@ static void bch2_sb_ext_to_text(struct printbuf *out, struct bch_sb *sb,
{ {
struct bch_sb_field_ext *e = field_to_type(f, ext); struct bch_sb_field_ext *e = field_to_type(f, ext);
prt_printf(out, "Recovery passes required:"); prt_printf(out, "Recovery passes required:\t");
prt_tab(out);
prt_bitflags(out, bch2_recovery_passes, prt_bitflags(out, bch2_recovery_passes,
bch2_recovery_passes_from_stable(le64_to_cpu(e->recovery_passes_required[0]))); bch2_recovery_passes_from_stable(le64_to_cpu(e->recovery_passes_required[0])));
prt_newline(out); prt_newline(out);
...@@ -1186,16 +1185,14 @@ static void bch2_sb_ext_to_text(struct printbuf *out, struct bch_sb *sb, ...@@ -1186,16 +1185,14 @@ static void bch2_sb_ext_to_text(struct printbuf *out, struct bch_sb *sb,
if (errors_silent) { if (errors_silent) {
le_bitvector_to_cpu(errors_silent, (void *) e->errors_silent, sizeof(e->errors_silent) * 8); le_bitvector_to_cpu(errors_silent, (void *) e->errors_silent, sizeof(e->errors_silent) * 8);
prt_printf(out, "Errors to silently fix:"); prt_printf(out, "Errors to silently fix:\t");
prt_tab(out);
prt_bitflags_vector(out, bch2_sb_error_strs, errors_silent, sizeof(e->errors_silent) * 8); prt_bitflags_vector(out, bch2_sb_error_strs, errors_silent, sizeof(e->errors_silent) * 8);
prt_newline(out); prt_newline(out);
kfree(errors_silent); kfree(errors_silent);
} }
prt_printf(out, "Btrees with missing data:"); prt_printf(out, "Btrees with missing data:\t");
prt_tab(out);
prt_bitflags(out, __bch2_btree_ids, le64_to_cpu(e->btrees_lost_data)); prt_bitflags(out, __bch2_btree_ids, le64_to_cpu(e->btrees_lost_data));
prt_newline(out); prt_newline(out);
} }
...@@ -1305,95 +1302,71 @@ void bch2_sb_to_text(struct printbuf *out, struct bch_sb *sb, ...@@ -1305,95 +1302,71 @@ void bch2_sb_to_text(struct printbuf *out, struct bch_sb *sb,
for (int i = 0; i < sb->nr_devices; i++) for (int i = 0; i < sb->nr_devices; i++)
nr_devices += bch2_dev_exists(sb, i); nr_devices += bch2_dev_exists(sb, i);
prt_printf(out, "External UUID:"); prt_printf(out, "External UUID:\t");
prt_tab(out);
pr_uuid(out, sb->user_uuid.b); pr_uuid(out, sb->user_uuid.b);
prt_newline(out); prt_newline(out);
prt_printf(out, "Internal UUID:"); prt_printf(out, "Internal UUID:\t");
prt_tab(out);
pr_uuid(out, sb->uuid.b); pr_uuid(out, sb->uuid.b);
prt_newline(out); prt_newline(out);
prt_printf(out, "Magic number:"); prt_printf(out, "Magic number:\t");
prt_tab(out);
pr_uuid(out, sb->magic.b); pr_uuid(out, sb->magic.b);
prt_newline(out); prt_newline(out);
prt_str(out, "Device index:"); prt_printf(out, "Device index:\t%u\n", sb->dev_idx);
prt_tab(out);
prt_printf(out, "%u", sb->dev_idx);
prt_newline(out);
prt_str(out, "Label:"); prt_str(out, "Label:\t");
prt_tab(out);
prt_printf(out, "%.*s", (int) sizeof(sb->label), sb->label); prt_printf(out, "%.*s", (int) sizeof(sb->label), sb->label);
prt_newline(out); prt_newline(out);
prt_str(out, "Version:"); prt_str(out, "Version:\t");
prt_tab(out);
bch2_version_to_text(out, le16_to_cpu(sb->version)); bch2_version_to_text(out, le16_to_cpu(sb->version));
prt_newline(out); prt_newline(out);
prt_str(out, "Version upgrade complete:"); prt_str(out, "Version upgrade complete:\t");
prt_tab(out);
bch2_version_to_text(out, BCH_SB_VERSION_UPGRADE_COMPLETE(sb)); bch2_version_to_text(out, BCH_SB_VERSION_UPGRADE_COMPLETE(sb));
prt_newline(out); prt_newline(out);
prt_printf(out, "Oldest version on disk:"); prt_printf(out, "Oldest version on disk:\t");
prt_tab(out);
bch2_version_to_text(out, le16_to_cpu(sb->version_min)); bch2_version_to_text(out, le16_to_cpu(sb->version_min));
prt_newline(out); prt_newline(out);
prt_printf(out, "Created:"); prt_printf(out, "Created:\t");
prt_tab(out);
if (sb->time_base_lo) if (sb->time_base_lo)
bch2_prt_datetime(out, div_u64(le64_to_cpu(sb->time_base_lo), NSEC_PER_SEC)); bch2_prt_datetime(out, div_u64(le64_to_cpu(sb->time_base_lo), NSEC_PER_SEC));
else else
prt_printf(out, "(not set)"); prt_printf(out, "(not set)");
prt_newline(out); prt_newline(out);
prt_printf(out, "Sequence number:"); prt_printf(out, "Sequence number:\t");
prt_tab(out);
prt_printf(out, "%llu", le64_to_cpu(sb->seq)); prt_printf(out, "%llu", le64_to_cpu(sb->seq));
prt_newline(out); prt_newline(out);
prt_printf(out, "Time of last write:"); prt_printf(out, "Time of last write:\t");
prt_tab(out);
bch2_prt_datetime(out, le64_to_cpu(sb->write_time)); bch2_prt_datetime(out, le64_to_cpu(sb->write_time));
prt_newline(out); prt_newline(out);
prt_printf(out, "Superblock size:"); prt_printf(out, "Superblock size:\t");
prt_tab(out);
prt_units_u64(out, vstruct_bytes(sb)); prt_units_u64(out, vstruct_bytes(sb));
prt_str(out, "/"); prt_str(out, "/");
prt_units_u64(out, 512ULL << sb->layout.sb_max_size_bits); prt_units_u64(out, 512ULL << sb->layout.sb_max_size_bits);
prt_newline(out); prt_newline(out);
prt_printf(out, "Clean:"); prt_printf(out, "Clean:\t%llu\n", BCH_SB_CLEAN(sb));
prt_tab(out); prt_printf(out, "Devices:\t%u\n", nr_devices);
prt_printf(out, "%llu", BCH_SB_CLEAN(sb));
prt_newline(out);
prt_printf(out, "Devices:");
prt_tab(out);
prt_printf(out, "%u", nr_devices);
prt_newline(out);
prt_printf(out, "Sections:"); prt_printf(out, "Sections:\t");
vstruct_for_each(sb, f) vstruct_for_each(sb, f)
fields_have |= 1 << le32_to_cpu(f->type); fields_have |= 1 << le32_to_cpu(f->type);
prt_tab(out);
prt_bitflags(out, bch2_sb_fields, fields_have); prt_bitflags(out, bch2_sb_fields, fields_have);
prt_newline(out); prt_newline(out);
prt_printf(out, "Features:"); prt_printf(out, "Features:\t");
prt_tab(out);
prt_bitflags(out, bch2_sb_features, le64_to_cpu(sb->features[0])); prt_bitflags(out, bch2_sb_features, le64_to_cpu(sb->features[0]));
prt_newline(out); prt_newline(out);
prt_printf(out, "Compat features:"); prt_printf(out, "Compat features:\t");
prt_tab(out);
prt_bitflags(out, bch2_sb_compat, le64_to_cpu(sb->compat[0])); prt_bitflags(out, bch2_sb_compat, le64_to_cpu(sb->compat[0]));
prt_newline(out); prt_newline(out);
...@@ -1410,8 +1383,7 @@ void bch2_sb_to_text(struct printbuf *out, struct bch_sb *sb, ...@@ -1410,8 +1383,7 @@ void bch2_sb_to_text(struct printbuf *out, struct bch_sb *sb,
if (opt->get_sb != BCH2_NO_SB_OPT) { if (opt->get_sb != BCH2_NO_SB_OPT) {
u64 v = bch2_opt_from_sb(sb, id); u64 v = bch2_opt_from_sb(sb, id);
prt_printf(out, "%s:", opt->attr.name); prt_printf(out, "%s:\t", opt->attr.name);
prt_tab(out);
bch2_opt_to_text(out, NULL, sb, opt, v, bch2_opt_to_text(out, NULL, sb, opt, v,
OPT_HUMAN_READABLE|OPT_SHOW_FULL_LIST); OPT_HUMAN_READABLE|OPT_SHOW_FULL_LIST);
prt_newline(out); prt_newline(out);
......
...@@ -189,12 +189,8 @@ static void bch2_write_refs_to_text(struct printbuf *out, struct bch_fs *c) ...@@ -189,12 +189,8 @@ static void bch2_write_refs_to_text(struct printbuf *out, struct bch_fs *c)
{ {
bch2_printbuf_tabstop_push(out, 24); bch2_printbuf_tabstop_push(out, 24);
for (unsigned i = 0; i < ARRAY_SIZE(c->writes); i++) { for (unsigned i = 0; i < ARRAY_SIZE(c->writes); i++)
prt_str(out, bch2_write_refs[i]); prt_printf(out, "%s\t%li\n", bch2_write_refs[i], atomic_long_read(&c->writes[i]));
prt_tab(out);
prt_printf(out, "%li", atomic_long_read(&c->writes[i]));
prt_newline(out);
}
} }
#endif #endif
...@@ -313,22 +309,11 @@ static int bch2_compression_stats_to_text(struct printbuf *out, struct bch_fs *c ...@@ -313,22 +309,11 @@ static int bch2_compression_stats_to_text(struct printbuf *out, struct bch_fs *c
if (ret) if (ret)
return ret; return ret;
prt_str(out, "type");
printbuf_tabstop_push(out, 12); printbuf_tabstop_push(out, 12);
prt_tab(out);
prt_str(out, "compressed");
printbuf_tabstop_push(out, 16); printbuf_tabstop_push(out, 16);
prt_tab_rjust(out);
prt_str(out, "uncompressed");
printbuf_tabstop_push(out, 16); printbuf_tabstop_push(out, 16);
prt_tab_rjust(out);
prt_str(out, "average extent size");
printbuf_tabstop_push(out, 24); printbuf_tabstop_push(out, 24);
prt_tab_rjust(out); prt_printf(out, "type\tcompressed\runcompressed\raverage extent size\r\n");
prt_newline(out);
for (unsigned i = 0; i < ARRAY_SIZE(s); i++) { for (unsigned i = 0; i < ARRAY_SIZE(s); i++) {
bch2_prt_compression_type(out, i); bch2_prt_compression_type(out, i);
...@@ -594,13 +579,11 @@ SHOW(bch2_fs_counters) ...@@ -594,13 +579,11 @@ SHOW(bch2_fs_counters)
if (attr == &sysfs_##t) { \ if (attr == &sysfs_##t) { \
counter = percpu_u64_get(&c->counters[BCH_COUNTER_##t]);\ counter = percpu_u64_get(&c->counters[BCH_COUNTER_##t]);\
counter_since_mount = counter - c->counters_on_mount[BCH_COUNTER_##t];\ counter_since_mount = counter - c->counters_on_mount[BCH_COUNTER_##t];\
prt_printf(out, "since mount:"); \ prt_printf(out, "since mount:\t"); \
prt_tab(out); \
prt_human_readable_u64(out, counter_since_mount); \ prt_human_readable_u64(out, counter_since_mount); \
prt_newline(out); \ prt_newline(out); \
\ \
prt_printf(out, "since filesystem creation:"); \ prt_printf(out, "since filesystem creation:\t"); \
prt_tab(out); \
prt_human_readable_u64(out, counter); \ prt_human_readable_u64(out, counter); \
prt_newline(out); \ prt_newline(out); \
} }
...@@ -796,11 +779,11 @@ static void dev_alloc_debug_to_text(struct printbuf *out, struct bch_dev *ca) ...@@ -796,11 +779,11 @@ static void dev_alloc_debug_to_text(struct printbuf *out, struct bch_dev *ca)
{ {
struct bch_fs *c = ca->fs; struct bch_fs *c = ca->fs;
struct bch_dev_usage stats = bch2_dev_usage_read(ca); struct bch_dev_usage stats = bch2_dev_usage_read(ca);
unsigned i, nr[BCH_DATA_NR]; unsigned nr[BCH_DATA_NR];
memset(nr, 0, sizeof(nr)); memset(nr, 0, sizeof(nr));
for (i = 0; i < ARRAY_SIZE(c->open_buckets); i++) for (unsigned i = 0; i < ARRAY_SIZE(c->open_buckets); i++)
nr[c->open_buckets[i].data_type]++; nr[c->open_buckets[i].data_type]++;
printbuf_tabstop_push(out, 8); printbuf_tabstop_push(out, 8);
...@@ -813,65 +796,24 @@ static void dev_alloc_debug_to_text(struct printbuf *out, struct bch_dev *ca) ...@@ -813,65 +796,24 @@ static void dev_alloc_debug_to_text(struct printbuf *out, struct bch_dev *ca)
prt_newline(out); prt_newline(out);
prt_printf(out, "reserves:"); prt_printf(out, "reserves:\n");
prt_newline(out); for (unsigned i = 0; i < BCH_WATERMARK_NR; i++)
for (i = 0; i < BCH_WATERMARK_NR; i++) { prt_printf(out, "%s\t%llu\r\n", bch2_watermarks[i], bch2_dev_buckets_reserved(ca, i));
prt_str(out, bch2_watermarks[i]);
prt_tab(out);
prt_u64(out, bch2_dev_buckets_reserved(ca, i));
prt_tab_rjust(out);
prt_newline(out);
}
prt_newline(out); prt_newline(out);
printbuf_tabstops_reset(out); printbuf_tabstops_reset(out);
printbuf_tabstop_push(out, 24); printbuf_tabstop_push(out, 24);
prt_str(out, "freelist_wait"); prt_printf(out, "freelist_wait\t%s\n", c->freelist_wait.list.first ? "waiting" : "empty");
prt_tab(out); prt_printf(out, "open buckets allocated\t%i\n", OPEN_BUCKETS_COUNT - c->open_buckets_nr_free);
prt_str(out, c->freelist_wait.list.first ? "waiting" : "empty"); prt_printf(out, "open buckets this dev\t%i\n", ca->nr_open_buckets);
prt_newline(out); prt_printf(out, "open buckets total\t%u\n", OPEN_BUCKETS_COUNT);
prt_printf(out, "open_buckets_wait\t%s\n", c->open_buckets_wait.list.first ? "waiting" : "empty");
prt_str(out, "open buckets allocated"); prt_printf(out, "open_buckets_btree\t%u\n", nr[BCH_DATA_btree]);
prt_tab(out); prt_printf(out, "open_buckets_user\t%u\n", nr[BCH_DATA_user]);
prt_u64(out, OPEN_BUCKETS_COUNT - c->open_buckets_nr_free); prt_printf(out, "buckets_to_invalidate\t%llu\n", should_invalidate_buckets(ca, stats));
prt_newline(out); prt_printf(out, "btree reserve cache\t%u\n", c->btree_reserve_cache_nr);
prt_str(out, "open buckets this dev");
prt_tab(out);
prt_u64(out, ca->nr_open_buckets);
prt_newline(out);
prt_str(out, "open buckets total");
prt_tab(out);
prt_u64(out, OPEN_BUCKETS_COUNT);
prt_newline(out);
prt_str(out, "open_buckets_wait");
prt_tab(out);
prt_str(out, c->open_buckets_wait.list.first ? "waiting" : "empty");
prt_newline(out);
prt_str(out, "open_buckets_btree");
prt_tab(out);
prt_u64(out, nr[BCH_DATA_btree]);
prt_newline(out);
prt_str(out, "open_buckets_user");
prt_tab(out);
prt_u64(out, nr[BCH_DATA_user]);
prt_newline(out);
prt_str(out, "buckets_to_invalidate");
prt_tab(out);
prt_u64(out, should_invalidate_buckets(ca, stats));
prt_newline(out);
prt_str(out, "btree reserve cache");
prt_tab(out);
prt_u64(out, c->btree_reserve_cache_nr);
prt_newline(out);
} }
static const char * const bch2_rw[] = { static const char * const bch2_rw[] = {
......
...@@ -348,15 +348,12 @@ static void bch2_pr_time_units_aligned(struct printbuf *out, u64 ns) ...@@ -348,15 +348,12 @@ static void bch2_pr_time_units_aligned(struct printbuf *out, u64 ns)
{ {
const struct time_unit *u = bch2_pick_time_units(ns); const struct time_unit *u = bch2_pick_time_units(ns);
prt_printf(out, "%llu ", div64_u64(ns, u->nsecs)); prt_printf(out, "%llu \r%s", div64_u64(ns, u->nsecs), u->name);
prt_tab_rjust(out);
prt_printf(out, "%s", u->name);
} }
static inline void pr_name_and_units(struct printbuf *out, const char *name, u64 ns) static inline void pr_name_and_units(struct printbuf *out, const char *name, u64 ns)
{ {
prt_str(out, name); prt_printf(out, "%s\t", name);
prt_tab(out);
bch2_pr_time_units_aligned(out, ns); bch2_pr_time_units_aligned(out, ns);
prt_newline(out); prt_newline(out);
} }
...@@ -389,12 +386,8 @@ void bch2_time_stats_to_text(struct printbuf *out, struct bch2_time_stats *stats ...@@ -389,12 +386,8 @@ void bch2_time_stats_to_text(struct printbuf *out, struct bch2_time_stats *stats
} }
printbuf_tabstop_push(out, out->indent + TABSTOP_SIZE); printbuf_tabstop_push(out, out->indent + TABSTOP_SIZE);
prt_printf(out, "count:"); prt_printf(out, "count:\t%llu\n", stats->duration_stats.n);
prt_tab(out);
prt_printf(out, "%llu ",
stats->duration_stats.n);
printbuf_tabstop_pop(out); printbuf_tabstop_pop(out);
prt_newline(out);
printbuf_tabstops_reset(out); printbuf_tabstops_reset(out);
...@@ -403,13 +396,8 @@ void bch2_time_stats_to_text(struct printbuf *out, struct bch2_time_stats *stats ...@@ -403,13 +396,8 @@ void bch2_time_stats_to_text(struct printbuf *out, struct bch2_time_stats *stats
printbuf_tabstop_push(out, 0); printbuf_tabstop_push(out, 0);
printbuf_tabstop_push(out, TABSTOP_SIZE + 2); printbuf_tabstop_push(out, TABSTOP_SIZE + 2);
prt_tab(out); prt_printf(out, "\tsince mount\r\trecent\r\n");
prt_printf(out, "since mount");
prt_tab_rjust(out);
prt_tab(out);
prt_printf(out, "recent"); prt_printf(out, "recent");
prt_tab_rjust(out);
prt_newline(out);
printbuf_tabstops_reset(out); printbuf_tabstops_reset(out);
printbuf_tabstop_push(out, out->indent + 20); printbuf_tabstop_push(out, out->indent + 20);
...@@ -417,23 +405,20 @@ void bch2_time_stats_to_text(struct printbuf *out, struct bch2_time_stats *stats ...@@ -417,23 +405,20 @@ void bch2_time_stats_to_text(struct printbuf *out, struct bch2_time_stats *stats
printbuf_tabstop_push(out, 2); printbuf_tabstop_push(out, 2);
printbuf_tabstop_push(out, TABSTOP_SIZE); printbuf_tabstop_push(out, TABSTOP_SIZE);
prt_printf(out, "duration of events"); prt_printf(out, "duration of events\n");
prt_newline(out);
printbuf_indent_add(out, 2); printbuf_indent_add(out, 2);
pr_name_and_units(out, "min:", stats->min_duration); pr_name_and_units(out, "min:", stats->min_duration);
pr_name_and_units(out, "max:", stats->max_duration); pr_name_and_units(out, "max:", stats->max_duration);
pr_name_and_units(out, "total:", stats->total_duration); pr_name_and_units(out, "total:", stats->total_duration);
prt_printf(out, "mean:"); prt_printf(out, "mean:\t");
prt_tab(out);
bch2_pr_time_units_aligned(out, d_mean); bch2_pr_time_units_aligned(out, d_mean);
prt_tab(out); prt_tab(out);
bch2_pr_time_units_aligned(out, mean_and_variance_weighted_get_mean(stats->duration_stats_weighted, TIME_STATS_MV_WEIGHT)); bch2_pr_time_units_aligned(out, mean_and_variance_weighted_get_mean(stats->duration_stats_weighted, TIME_STATS_MV_WEIGHT));
prt_newline(out); prt_newline(out);
prt_printf(out, "stddev:"); prt_printf(out, "stddev:\t");
prt_tab(out);
bch2_pr_time_units_aligned(out, d_stddev); bch2_pr_time_units_aligned(out, d_stddev);
prt_tab(out); prt_tab(out);
bch2_pr_time_units_aligned(out, mean_and_variance_weighted_get_stddev(stats->duration_stats_weighted, TIME_STATS_MV_WEIGHT)); bch2_pr_time_units_aligned(out, mean_and_variance_weighted_get_stddev(stats->duration_stats_weighted, TIME_STATS_MV_WEIGHT));
...@@ -441,22 +426,19 @@ void bch2_time_stats_to_text(struct printbuf *out, struct bch2_time_stats *stats ...@@ -441,22 +426,19 @@ void bch2_time_stats_to_text(struct printbuf *out, struct bch2_time_stats *stats
printbuf_indent_sub(out, 2); printbuf_indent_sub(out, 2);
prt_newline(out); prt_newline(out);
prt_printf(out, "time between events"); prt_printf(out, "time between events\n");
prt_newline(out);
printbuf_indent_add(out, 2); printbuf_indent_add(out, 2);
pr_name_and_units(out, "min:", stats->min_freq); pr_name_and_units(out, "min:", stats->min_freq);
pr_name_and_units(out, "max:", stats->max_freq); pr_name_and_units(out, "max:", stats->max_freq);
prt_printf(out, "mean:"); prt_printf(out, "mean:\t");
prt_tab(out);
bch2_pr_time_units_aligned(out, f_mean); bch2_pr_time_units_aligned(out, f_mean);
prt_tab(out); prt_tab(out);
bch2_pr_time_units_aligned(out, mean_and_variance_weighted_get_mean(stats->freq_stats_weighted, TIME_STATS_MV_WEIGHT)); bch2_pr_time_units_aligned(out, mean_and_variance_weighted_get_mean(stats->freq_stats_weighted, TIME_STATS_MV_WEIGHT));
prt_newline(out); prt_newline(out);
prt_printf(out, "stddev:"); prt_printf(out, "stddev:\t");
prt_tab(out);
bch2_pr_time_units_aligned(out, f_stddev); bch2_pr_time_units_aligned(out, f_stddev);
prt_tab(out); prt_tab(out);
bch2_pr_time_units_aligned(out, mean_and_variance_weighted_get_stddev(stats->freq_stats_weighted, TIME_STATS_MV_WEIGHT)); bch2_pr_time_units_aligned(out, mean_and_variance_weighted_get_stddev(stats->freq_stats_weighted, TIME_STATS_MV_WEIGHT));
...@@ -589,40 +571,31 @@ void bch2_pd_controller_debug_to_text(struct printbuf *out, struct bch_pd_contro ...@@ -589,40 +571,31 @@ void bch2_pd_controller_debug_to_text(struct printbuf *out, struct bch_pd_contro
if (!out->nr_tabstops) if (!out->nr_tabstops)
printbuf_tabstop_push(out, 20); printbuf_tabstop_push(out, 20);
prt_printf(out, "rate:"); prt_printf(out, "rate:\t");
prt_tab(out);
prt_human_readable_s64(out, pd->rate.rate); prt_human_readable_s64(out, pd->rate.rate);
prt_newline(out); prt_newline(out);
prt_printf(out, "target:"); prt_printf(out, "target:\t");
prt_tab(out);
prt_human_readable_u64(out, pd->last_target); prt_human_readable_u64(out, pd->last_target);
prt_newline(out); prt_newline(out);
prt_printf(out, "actual:"); prt_printf(out, "actual:\t");
prt_tab(out);
prt_human_readable_u64(out, pd->last_actual); prt_human_readable_u64(out, pd->last_actual);
prt_newline(out); prt_newline(out);
prt_printf(out, "proportional:"); prt_printf(out, "proportional:\t");
prt_tab(out);
prt_human_readable_s64(out, pd->last_proportional); prt_human_readable_s64(out, pd->last_proportional);
prt_newline(out); prt_newline(out);
prt_printf(out, "derivative:"); prt_printf(out, "derivative:\t");
prt_tab(out);
prt_human_readable_s64(out, pd->last_derivative); prt_human_readable_s64(out, pd->last_derivative);
prt_newline(out); prt_newline(out);
prt_printf(out, "change:"); prt_printf(out, "change:\t");
prt_tab(out);
prt_human_readable_s64(out, pd->last_change); prt_human_readable_s64(out, pd->last_change);
prt_newline(out); prt_newline(out);
prt_printf(out, "next io:"); prt_printf(out, "next io:\t%llims\n", div64_s64(pd->rate.next - local_clock(), NSEC_PER_MSEC));
prt_tab(out);
prt_printf(out, "%llims", div64_s64(pd->rate.next - local_clock(), NSEC_PER_MSEC));
prt_newline(out);
} }
/* misc: */ /* misc: */
......
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