summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-08-11 21:06:02 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-08-11 21:08:01 -0400
commit04a44d244c0df3937b177fe78570d1c65851ca60 (patch)
tree4b12d4ed9348b65e91ea4429aeb1e127550e0709
parent2c5c54f44ab14b394c7c3a55109c7d61a1fe928a (diff)
bcachefs: Print last line in debugfs/btree_transaction_stats
We need to turn the flush_buf() thing into a proper API, to replace seq_file. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r--fs/bcachefs/debug.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/bcachefs/debug.c b/fs/bcachefs/debug.c
index 781cb22e6304..938740544469 100644
--- a/fs/bcachefs/debug.c
+++ b/fs/bcachefs/debug.c
@@ -658,8 +658,7 @@ static ssize_t lock_held_stats_read(struct file *file, char __user *buf,
i->size = size;
i->ret = 0;
- while (i->iter < ARRAY_SIZE(c->btree_transaction_fns) &&
- c->btree_transaction_fns[i->iter]) {
+ while (1) {
struct btree_transaction_stats *s = &c->btree_transaction_stats[i->iter];
err = flush_buf(i);
@@ -669,6 +668,10 @@ static ssize_t lock_held_stats_read(struct file *file, char __user *buf,
if (!i->size)
break;
+ if (i->iter == ARRAY_SIZE(c->btree_transaction_fns) ||
+ !c->btree_transaction_fns[i->iter])
+ break;
+
prt_printf(&i->buf, "%s: ", c->btree_transaction_fns[i->iter]);
prt_newline(&i->buf);
printbuf_indent_add(&i->buf, 2);