summaryrefslogtreecommitdiff
path: root/fs/bcachefs/journal_reclaim.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-02-25 21:18:19 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:25 +0300
commitfa8e94faeece12c20b541f647059f29867e98bc0 (patch)
tree43c5542168a6324d69c8671724e62c46e6265b8c /fs/bcachefs/journal_reclaim.c
parent2be7b16eee9442f2c45ebde19bd3b50fcd030515 (diff)
downloadlinux-fa8e94faeece12c20b541f647059f29867e98bc0.tar.xz
bcachefs: Heap allocate printbufs
This patch changes printbufs dynamically allocate and reallocate a buffer as needed. Stack usage has become a bit of a problem, and a major cause of that has been static size string buffers on the stack. The most involved part of this refactoring is that printbufs must now be exited with printbuf_exit(). Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/journal_reclaim.c')
-rw-r--r--fs/bcachefs/journal_reclaim.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c
index c15b18831512..2d5382a83003 100644
--- a/fs/bcachefs/journal_reclaim.c
+++ b/fs/bcachefs/journal_reclaim.c
@@ -216,14 +216,11 @@ void bch2_journal_space_available(struct journal *j)
if (!clean_ondisk &&
j->reservations.idx ==
j->reservations.unwritten_idx) {
- char *buf = kmalloc(4096, GFP_ATOMIC);
+ struct printbuf buf = PRINTBUF;
- bch_err(c, "journal stuck");
- if (buf) {
- __bch2_journal_debug_to_text(&_PBUF(buf, 4096), j);
- pr_err("\n%s", buf);
- kfree(buf);
- }
+ __bch2_journal_debug_to_text(&buf, j);
+ bch_err(c, "journal stuck\n%s", buf.buf);
+ printbuf_exit(&buf);
bch2_fatal_error(c);
ret = cur_entry_journal_stuck;