summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);