From 04a44d244c0df3937b177fe78570d1c65851ca60 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 11 Aug 2022 21:06:02 -0400 Subject: 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 --- fs/bcachefs/debug.c | 7 +++++-- 1 file 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); -- cgit v1.2.3